Question
We have deployed a pod called web-pod (where port 80 was exposed using service web-pod).
Incoming connections (from a pod apicheck to web-pod) are not working.
Identify and make certain changes on pod apicheck (redeploy is needed) so that it can access web-pod.
Note: A NetworkPolicy named api-allow was also created as part of the deployment
Answer
Get details about NetworkPolicy:
kubectl get netpol
kubectl describe netpol api-allow
can be observed the following - a pod selector for ingress traffic for labels: app=bookstore,role=apikubectl get po --show-labels
can be noticed that only pod web-pod have above labels.kubectl get svc
Let's test a connection from pod apicheck to service web-pod:
kubectl exec -it apicheck -- wget http://web-pod
We can see the connectoin timeout.
To fix this, we beed to edit the apicheck pod:
kubectl edit po apicheck
and add one more missing label app=bookstorekubectl exec -it apicheck -- wget http://web-pod
Connectivity issue is fixed