Reputation: 360
Is it normal that I can access a pod through any worker node IP and also through master node IP?
kubectl get pods -o wide
shows that the pod is on one specific worker node but I can access it from any master or woker public IP. I have 1 replica of that pod.
Can someone help explain why?
Upvotes: 0
Views: 364
Reputation: 44657
This is only possible if you are using NodePort type service. It's because by design the NodePort is opened on all nodes in the cluster including master nodes.
From the docs
NodePort: Exposes the Service on each Node's IP at a static port (the NodePort). A ClusterIP Service, to which the NodePort Service routes, is automatically created. You'll be able to contact the NodePort Service, from outside the cluster, by requesting <NodeIP>:<NodePort>
If you are looking for a way to avoid this use ingress with ClusterIP
type service.
Upvotes: 1