dgkanatsios / CKAD-exercises

A set of exercises to prepare for Certified Kubernetes Application Developer exam by Cloud Native Computing Foundation
MIT License
8.78k stars 5.64k forks source link

This solution isn't working (or is it just me?) #95

Closed gauravpatel2016 closed 4 years ago

gauravpatel2016 commented 4 years ago

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 fine

Thanks

MihaiBojin commented 4 years ago

Have you tried this exercise in Minikube (which does not have a network plugin enabled by default)?

gauravpatel2016 commented 4 years ago

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?

gauravpatel2016 commented 4 years ago

I found the reason.

dgkanatsios commented 4 years ago

Thanks @gauravpatel2016. Can you mention what happened, just in case it happens to somebody else?

gauravpatel2016 commented 4 years ago

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.