Skip to content

Instantly share code, notes, and snippets.

@onpaws
Last active September 1, 2020 17:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onpaws/e905f76a23f12858cc19a2dd8a62514b to your computer and use it in GitHub Desktop.
Save onpaws/e905f76a23f12858cc19a2dd8a62514b to your computer and use it in GitHub Desktop.
Accessing a Service inside Kind without an Ingress
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