--- reviewers: - danwent - aanm title: Use Cilium for NetworkPolicy content_type: task weight: 20 --- This page shows how to use Cilium for NetworkPolicy. For background on Cilium, read the [Introduction to Cilium](https://docs.cilium.io/en/stable/intro). ## {{% heading "prerequisites" %}} {{< include "task-tutorial-prereqs.md" >}} {{< version-check >}} ## Deploying Cilium on Minikube for Basic Testing To get familiar with Cilium easily you can follow the [Cilium Kubernetes Getting Started Guide](https://docs.cilium.io/en/stable/gettingstarted/k8s-install-default/) to perform a basic DaemonSet installation of Cilium in minikube. To start minikube, minimal version required is >= v1.5.2, run the with the following arguments: ```shell minikube version ``` ``` minikube version: v1.5.2 ``` ```shell minikube start --network-plugin=cni ``` For minikube you can install Cilium using its CLI tool. Cilium will automatically detect the cluster configuration and will install the appropriate components for a successful installation: ```shell curl -LO https://github.com/cilium/cilium-cli/releases/latest/download/cilium-linux-amd64.tar.gz sudo tar xzvfC cilium-linux-amd64.tar.gz /usr/local/bin rm cilium-linux-amd64.tar.gz cilium install ``` ``` 🔮 Auto-detected Kubernetes kind: minikube ✨ Running "minikube" validation checks ✅ Detected minikube version "1.20.0" â„šī¸ Cilium version not set, using default version "v1.10.0" 🔮 Auto-detected cluster name: minikube 🔮 Auto-detected IPAM mode: cluster-pool 🔮 Auto-detected datapath mode: tunnel 🔑 Generating CA... 2021/05/27 02:54:44 [INFO] generate received request 2021/05/27 02:54:44 [INFO] received CSR 2021/05/27 02:54:44 [INFO] generating key: ecdsa-256 2021/05/27 02:54:44 [INFO] encoded CSR 2021/05/27 02:54:44 [INFO] signed certificate with serial number 48713764918856674401136471229482703021230538642 🔑 Generating certificates for Hubble... 2021/05/27 02:54:44 [INFO] generate received request 2021/05/27 02:54:44 [INFO] received CSR 2021/05/27 02:54:44 [INFO] generating key: ecdsa-256 2021/05/27 02:54:44 [INFO] encoded CSR 2021/05/27 02:54:44 [INFO] signed certificate with serial number 3514109734025784310086389188421560613333279574 🚀 Creating Service accounts... 🚀 Creating Cluster roles... 🚀 Creating ConfigMap... 🚀 Creating Agent DaemonSet... 🚀 Creating Operator Deployment... ⌛ Waiting for Cilium to be installed... ``` The remainder of the Getting Started Guide explains how to enforce both L3/L4 (i.e., IP address + port) security policies, as well as L7 (e.g., HTTP) security policies using an example application. ## Deploying Cilium for Production Use For detailed instructions around deploying Cilium for production, see: [Cilium Kubernetes Installation Guide](https://docs.cilium.io/en/stable/concepts/kubernetes/intro/) This documentation includes detailed requirements, instructions and example production DaemonSet files. ## Understanding Cilium components Deploying a cluster with Cilium adds Pods to the `kube-system` namespace. To see this list of Pods run: ```shell kubectl get pods --namespace=kube-system -l k8s-app=cilium ``` You'll see a list of Pods similar to this: ```console NAME READY STATUS RESTARTS AGE cilium-kkdhz 1/1 Running 0 3m23s ... ``` A `cilium` Pod runs on each node in your cluster and enforces network policy on the traffic to/from Pods on that node using Linux BPF. ## {{% heading "whatsnext" %}} Once your cluster is running, you can follow the [Declare Network Policy](/docs/tasks/administer-cluster/declare-network-policy/) to try out Kubernetes NetworkPolicy with Cilium. Have fun, and if you have questions, contact us using the [Cilium Slack Channel](https://cilium.herokuapp.com/).