Install Calico for policy and flannel (aka Canal) for networking
Before you begin
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.
-
Kubernetes API datastore (recommended)
Installing with the Kubernetes API datastore (recommended)
-
Ensure that the Kubernetes controller manager has the following flags set:
--cluster-cidr=<your-pod-cidr>
and--allocate-node-cidrs=true
.tipOn kubeadm, you can pass
--pod-network-cidr=<your-pod-cidr>
to kubeadm to set both Kubernetes controller flags. -
Download the flannel networking manifest for the Kubernetes API datastore.
curl https://raw.githubusercontent.com/projectcalico/calico/v3.29.0/manifests/canal.yaml -O
-
If your cluster is configured to use pod CIDR
10.244.0.0/16
, skip to the next step. If your cluster is configured to use a different pod CIDR, replace10.244.0.0/16
in the downloaded manifest with the correct pod CIDR. -
Issue the following command to install Calico.
kubectl apply -f canal.yaml
-
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 | IPAM | CNI | Overlay | Routing | Datastore |
---|---|---|---|---|---|
Installing with the etcd datastore
We strongly recommend using the Kubernetes API datastore, but if you prefer to use etcd, complete the following steps.
-
Download the Calico networking manifest.
curl https://raw.githubusercontent.com/projectcalico/calico/v3.29.0/manifests/canal-etcd.yaml -O
-
If your cluster is configured to use pod CIDR
10.244.0.0/16
, skip to the next step. If your cluster is configured to use a different pod CIDR, replace10.244.0.0/16
in the downloaded manifest with the correct pod CIDR. -
In the
ConfigMap
namedcalico-config
, set the value ofetcd_endpoints
to the IP address and port of your etcd server.tipYou can specify more than one using commas as delimiters.
-
Apply the manifest using the following command.
kubectl apply -f canal-etcd.yaml
-
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 | IPAM | CNI | Overlay | Routing | Datastore |
---|---|---|---|---|---|