This tutorial assumers that minikube kubernetes is already installed. Steps to access pod IP endpoint using curl
- Instal minikube and kubernetes
- create multi replica deployment
- Find pod IPs
kubectl get pods -l app=hello-minikube -o yaml | grep podIP
podIP: 10.244.0.3 podIPs: podIP: 10.244.1.6 podIPs: podIP: 10.244.1.5 podIPs:
- Ssh to minikube VM (one of the nodes)
minikube ssh
- Run curl to access podIP:port
curl POD_IP_ONE_OF_THE_ABOVE_LIST:8080
curl 10.244.0.3:8080
Request served by hello-minikube-7ddcbc9b8b-nmc2c HTTP/1.1 GET / Host: 10.244.0.3:8080 Accept: */* User-Agent: curl/7.68.0
- Another alternative is to use proxy (ssh not needed in this case)
kubectl port-forward hello-minikube-7ddcbc9b8b-nmc2c 8080
curl localhost:8080
- To get podName for above command
kubectl get pods -l app=hello-minikube
NAME READY STATUS RESTARTS AGE hello-minikube-7ddcbc9b8b-nmc2c 1/1 Running 0 4h5m hello-minikube-7ddcbc9b8b-t2wll 1/1 Running 0 4h5m hello-minikube-7ddcbc9b8b-zsrxc 1/1 Running 0 4h5m