Photo by Taylor Vick on Unsplash
I use Kind on a Windows laptop with WSL2.
It's a wonderful tool, that i use along with Tilt.
I tried to use ingress as described on the site but it was failing.
WSL2 and nodePort
I discovered first, that i had to use a custom configuration for KinD.
But even with this one, it was failing.
The connection keeps getting refused.
I tried using Lens, to see if i can access to the service. And i did, briefly.
After diving into different issues or this one, i decide to change default port for serving ingress.
Change Port
As i a m using a corporate laptop, my 80 port cannot be used for dev purpose as a proxy is already using it.
So i had to change it. Let's pick port 5080.
I change my configuration for cluster :
cat <<EOF | kind create cluster --name "${KIND_CLUSTER_NAME}" --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
extraPortMappings:
- containerPort: 5080
hostPort: 5080
protocol: TCP
- containerPort: 443
hostPort: 443
protocol: TCP
kubeadmConfigPatches:
- |
kind: JoinConfiguration
nodeRegistration:
kubeletExtraArgs:
node-labels: "ingress-ready=true"
EOF
And i change the yaml Ambassador operator used for KinD by the following :
---
apiVersion: getambassador.io/v2
kind: AmbassadorInstallation
metadata:
name: ambassador
spec:
installOSS: true
helmValues:
deploymentTool: amb-oper-kind
tolerations:
- key: "node-role.kubernetes.io/master"
operator: Equal
effect: NoSchedule
replicaCount: 1
deploymentStrategy:
type: Recreate
nodeSelector:
ingress-ready: "true"
service:
type: NodePort
ports:
- name: http
port: 80
hostPort: 5080
targetPort: 8080
protocol: TCP
- name: https
port: 443
hostPort: 443
targetPort: 8443
protocol: TCP
And then, by applying the example Ingress on the Kind site, i can finally do
curl localhost:5080/foo
Hope this helps !
Top comments (0)