Setting up an ingress controller on a kind k8s cluster
- Docker or Podman
- If you're running Podman, please see this.
- kind (Tested with v0.22.0)
- kubectl (Tested with v1.29.2 - same version as cluster)
- Prepare kind cluster with port mappings:
kind create cluster --config="cluster-config.yml"
Note: To support running as rootless Docker/Podman we bind http (80) to port 1080 on localhost and https (443) to port 1443 on localhost
- Deploy nginx ingress controller to cluster
kubectl apply -f kind-nginx-ingress.yml
kubectl wait --namespace ingress-nginx \
--for=condition=ready pod \
--selector=app.kubernetes.io/component=controller \
--timeout=90s
- Deploy the example workloads (pods, services and ingress)
kubectl apply -f workloads.yml
kubectl wait \
--for=condition=ready pod \
--selector=workload=ingress-demo \
--timeout=90s
- Run curl against the ingress controller on the specified ports/paths
curl localhost:1080/foo
curl localhost:1080/bar
Output:
'hello world! this is foo!'
'hello world! this is bar!'
- Run
kubectl delete -f workloads.yml
if you want to remove the example workloads - Run
kubectl delete -f kind-nginx-ingress.yml
if you want to remove the ingress controller - Run
kind delete cluster
to remove the full cluster
- This guide is based on the existing kind docs on setting up a nginx ingress controller. Some minor tweaks in k8s specs, updated to use Ingress v1 and customized to run on rootless Docker/Podman.
- Diagrams created with cloudskew