Last active
September 1, 2020 17:23
-
-
Save onpaws/e905f76a23f12858cc19a2dd8a62514b to your computer and use it in GitHub Desktop.
Accessing a Service inside Kind without an Ingress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat <<EOF | kind create cluster --config=- | |
kind: Cluster | |
apiVersion: kind.x-k8s.io/v1alpha4 | |
nodes: | |
- role: control-plane | |
kubeadmConfigPatches: | |
- | | |
kind: InitConfiguration | |
nodeRegistration: | |
kubeletExtraArgs: | |
node-labels: "ingress-ready=true" | |
extraPortMappings: | |
- containerPort: 30303 | |
hostPort: 80 | |
protocol: TCP | |
EOF | |
cat <<EOF | kubectl apply -f - | |
kind: Pod | |
apiVersion: v1 | |
metadata: | |
name: bar-app | |
labels: | |
app: bar | |
spec: | |
containers: | |
- name: bar-app | |
image: hashicorp/http-echo:0.2.3 | |
args: | |
- "-text=bar" | |
--- | |
kind: Service | |
apiVersion: v1 | |
metadata: | |
name: bar-service | |
spec: | |
type: NodePort | |
selector: | |
app: bar | |
ports: | |
# Default port used by the image | |
- port: 5678 | |
nodePort: 30303 | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment