Install Calico for policy and flannel (aka Canal) for networking

2 MINUTE READ

Before you begin

Note: Calico includes native VXLAN capabilities without the need for flannel. If you’re planning on using flannel for VXLAN, we recommend instead installing Calico using IP-in-IP or VXLAN mode. See how to determine the best networking option for your cluster. If you’re already using flannel for networking, you can migrate your existing clusters to Calico networking.

Ensure that you have a Kubernetes cluster that meets the Calico system requirements. If you don’t, follow the steps in Installing kubeadm.

Installing Calico for policy and flannel (aka Canal) for networking

Selecting a datastore type

The procedure differs according to your datastore type. Refer to the section that matches your type.

  1. Ensure that the Kubernetes controller manager has the following flags set:
    --cluster-cidr=<your-pod-cidr> and --allocate-node-cidrs=true.

    Tip: On kubeadm, you can pass --pod-network-cidr=<your-pod-cidr> to kubeadm to set both Kubernetes controller flags.

  2. Download the flannel networking manifest for the Kubernetes API datastore.

    curl https://docs.projectcalico.org/manifests/canal.yaml -O
    
  3. If you are using pod CIDR 10.244.0.0/16, skip to the next step. If you are using a different pod CIDR with kubeadm, no changes are required - Calico will automatically detect the CIDR based on the running configuration. For other platforms, make sure you uncomment the CALICO_IPV4POOL_CIDR variable in the manifest and set it to the same value as your chosen pod CIDR.

  4. Issue the following command to install Calico.

    kubectl apply -f canal.yaml
    
  5. If you wish to enforce application layer policies and secure workload-to-workload communications with mutual TLS authentication, continue to Enable application layer policy (optional).

The geeky details of what you get:

Policy
Calico
IPAM
Host-local
CNI
Calico
Overlay
VXLAN
Routing
Static
Datastore
Kubernetes
?

Installing with the etcd datastore

We strongly recommend using the Kubernetes API datastore, but if you prefer to use etcd, complete the following steps.

  1. Download the Calico networking manifest.

    curl https://docs.projectcalico.org/manifests/canal-etcd.yaml -O
    
  2. If you are using pod CIDR 10.244.0.0/16, skip to the next step. If you are using a different pod CIDR with kubeadm, no changes are required - Calico will automatically detect the CIDR based on the running configuration. For other platforms, make sure you uncomment the CALICO_IPV4POOL_CIDR variable in the manifest and set it to the same value as your chosen pod CIDR.

  3. In the ConfigMap named calico-config, set the value of etcd_endpoints to the IP address and port of your etcd server.

    Tip: You can specify more than one using commas as delimiters.

  4. Apply the manifest using the following command.

    kubectl apply -f canal-etcd.yaml
    
  5. If you wish to enforce application layer policies and secure workload-to-workload communications with mutual TLS authentication, continue to Enable application layer policy (optional).

The geeky details of what you get:

Policy
Calico
IPAM
Host-local
CNI
Calico
Overlay
VXLAN
Routing
Static
Datastore
etcd
?