If you directly use the online version of Kubernetes for debugging, it requires too many resources. Sometimes, using Minikube fails to start the cluster. Therefore, developers can consider using Kind to deploy and test Kubernetes.
This article is about using Kind to create a Kubernetes (K8s) cluster and debug it.
By default, Kind does not support load balancers. If you want to test your apps, use NodePort
or ClusterIP
instead.
Source code: svtter/example-code-for-kind.
Using NodePort to View Service
Get the node’s IP to visit:
(base) ➜ cathodic kubectl get nodes -o wide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
kind-control-plane Ready control-plane 22h v1.30.0 172.18.0.2 <none> Debian GNU/Linux 12 (bookworm) 6.1.0-18-amd64 containerd://1.7.15
View the service IP:
(base) ➜ cathodic kubectl get service nginx-service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
nginx-service NodePort 10.96.65.77 <none> 80:30160/TCP 26m
Now, use curl -L http://172.18.0.2:30160
to visit the Nginx service.
Using LoadBalancer
- Install cloud-provider-kind via this loadbalancer.
- Start Kind, unlabel the node, and start
cloud-provider-kind
according to this link.