⎈ k8s knowledge compiler

Use Cilium for NetworkPolicy [page]deterministic

tasksnetworkingsecurity

This page shows how to use Cilium for NetworkPolicy.

For background on Cilium, read the [Introduction to Cilium](https://docs.cilium.io/en/stable/overview/intro).

##

## 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, which requires version v1.5.2 or higher, run it 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. To do so, first download the latest version of the CLI with the following command:

```shell curl -LO https://github.com/cilium/cilium-cli/releases/latest/download/cilium-linux-amd64.tar.gz ```

Then extract the downloaded file to your `/usr/local/bin` directory with the following command:

```shell sudo tar xzvfC cilium-linux-amd64.tar.gz /usr/local/bin rm cilium-linux-amd64.tar.gz ```

After running the above commands, you can now install Cilium with the following command:

```shell cilium install ```

Cilium will then automatically detect the cluster configuration and create and install the appropriate components for a successful installation. The components are:

  • Certificate Authority (CA) in Secret `cilium-ca` and certificates for Hubble (Cilium's observability layer).
  • Service accounts.
  • Cluster roles.
  • ConfigMap.
  • Agent DaemonSet and an Operator Deployment.

After the installation, you can view the overall status of the Cilium deployment with the `cilium status` command. See the expected output of the `status` command [here](https://docs.cilium.io/en/stable/gettingstarted/k8s-install-default/#validate-the-installation).

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/network/kubernetes/concepts/) 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.

##

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://slack.cilium.io/).

Sources

tasks/administer-cluster/network-policy-provider/cilium-network-policy.md · docUse Cilium for NetworkPolicy

Related (6)

part_of {{% heading "prerequisites" %}}describes conf=1
part_of Deploying Cilium for Production Usedescribes conf=1
part_of Understanding Cilium componentsdescribes conf=1
part_of {{% heading "whatsnext" %}}describes conf=1
api_for NetworkPolicydocuments API object conf=1

← all Docs