Closed gauravpatel2016 closed 4 years ago
Have you tried this exercise in Minikube (which does not have a network plugin enabled by default)?
I did it in mac docker-desktop and katakoda too...Do I need to have some kind of kubernetes flannel or some cluster networking before I complete this exercise?
I found the reason.
Thanks @gauravpatel2016. Can you mention what happened, just in case it happens to somebody else?
To apply network policy, you must have networking solution installed like flannel. Locally and katakoda, they were not installed. I tried where networking solution was installed. and It worked fine after that.
I followed all the steps in this exercise https://github.com/dgkanatsios/CKAD-exercises/blob/master/f.services.md#create-an-nginx-deployment-of-2-replicas-expose-it-via-a-clusterip-service-on-port-80-create-a-networkpolicy-so-that-only-pods-with-labels-access-granted-can-access-the-deployment-and-apply-it
But for some reason busybox pod without label is still able to access Nginx service. i am not sure what is the issue.
kubectl run busybox --image=busybox --rm -it --restart=Never -- wget -O- http://nginx:80 --timeout 2
should timeout but I get index.html fineThanks