Anton Tsvetkov
1 min readAug 18, 2019

Enable Network Policy on minikube

I think my post will be helpful for those, who want to play around with Kubernetes Network Policy, but doesn’t have access to GKE, EKS or any other kubernetes environment with an ability to tune a network stack.

As you might already know the three main kubernetes playgrounds: minikube, katacoda and labs.play-with-k8s.com don’t support Network Policy.

But there is a solution to enable Network Policy on minikube by using Cilium (https://kubernetes.io/docs/tasks/administer-cluster/network-policy-provider/cilium-network-policy/). I tried to follow the steps described in the documentation, but without a success: networking in my minikube stops working at all.

So, here is my solution:

  1. Delete your current minikube cluster:
minikube delete

2. Start minikube cluster with the following options:

minikube start --network-plugin=cni --enable-default-cni# check that all kuberenetes services are ok:
kubectl get pods -n kube-system

3. Install Cilium (https://cilium.readthedocs.io/en/stable/gettingstarted/minikube/#install-cilium)

kubectl create -f https://raw.githubusercontent.com/cilium/cilium/1.5.6/examples/kubernetes/1.15/cilium-minikube.yaml# check that cilium pod is ok:
kubectl get pods -n kube-system -l k8s-app=cilium

4. Now you can test Network Policy rules!