Getting Started Using MicroK8s

This guide uses microk8s to demonstrate deployment and operation of Cilium in a single-node Kubernetes cluster. To run Cilium inside microk8s, a GNU/Linux distribution with kernel 4.9 or later is required (per the System Requirements).

Install microk8s

  1. Install microk8s >= 1.14 as per microk8s documentation: MicroK8s User guide.

  2. Enable the microk8s DNS service

    microk8s.enable dns
    
  3. Configure microk8s to use CNI and allow Cilium to register as that CNI:

    echo "--allow-privileged" >> /var/snap/microk8s/current/args/kube-apiserver
    sed -i 's/--network-plugin=kubenet/--network-plugin=cni/g'  /var/snap/microk8s/current/args/kubelet
    sed -i 's/--cni-bin-dir=${SNAP}/opt/--cni-bin-dir=/opt/g'  /var/snap/microk8s/current/args/kubelet
    sed -i 's/bin_dir = "${SNAP}/opt/bin_dir = "/opt/g'  /var/snap/microk8s/current/args/containerd-template.toml
    rm /var/snap/microk8s/current/args/cni-network/cni.conf
    curl https://raw.githubusercontent.com/cilium/cilium/v1.5/plugins/cilium-cni/05-cilium-cni.conf > /var/snap/microk8s/current/args/cni-network/05-cilium.conf
    systemctl restart snap.microk8s.daemon-containerd.service
    systemctl restart snap.microk8s.daemon-apiserver.service
    systemctl restart snap.microk8s.daemon-kubelet.service
    
  4. Install or configure kubectl.

    • Microk8s provides a version of kubectl, so if you don’t otherwise have it installed then you can simply alias the microk8s version:

      snap alias microk8s.kubectl kubectl
      
    • Alternatively, if you already have kubectl installed then you can simply point it at the microk8s version of the kubernetes API server:

      export KUBECONFIG=/snap/microk8s/current/client.config
      

Install etcd

Install etcd as a StatefulSet into your new Kubernetes cluster.

kubectl create -f https://raw.githubusercontent.com/cilium/cilium/v1.5/examples/kubernetes/addons/etcd/standalone-etcd.yaml -n kube-system

Install Cilium

Install Cilium as a DaemonSet into your new Kubernetes cluster. The DaemonSet will automatically install itself as Kubernetes CNI plugin.

kubectl create -f https://raw.githubusercontent.com/cilium/cilium/v1.5/examples/kubernetes/1.15/cilium-microk8s.yaml
kubectl create -f https://raw.githubusercontent.com/cilium/cilium/v1.5/examples/kubernetes/1.14/cilium-microk8s.yaml
kubectl create -f https://raw.githubusercontent.com/cilium/cilium/v1.5/examples/kubernetes/1.13/cilium-microk8s.yaml
kubectl create -f https://raw.githubusercontent.com/cilium/cilium/v1.5/examples/kubernetes/1.12/cilium-microk8s.yaml
kubectl create -f https://raw.githubusercontent.com/cilium/cilium/v1.5/examples/kubernetes/1.11/cilium-microk8s.yaml
kubectl create -f https://raw.githubusercontent.com/cilium/cilium/v1.5/examples/kubernetes/1.10/cilium-microk8s.yaml

Next steps

Now that you have a Kubernetes cluster with Cilium up and running, you can take a couple of next steps to explore various capabilities: