Kind multi-node install

Big picture

This tutorial gets you a multi node Kind cluster with Calico in approximately 10 minutes.

Value

kind is a tool for running local Kubernetes clusters using Docker container “nodes”.

The geeky details of what you get:

PolicyIPAMCNIOverlayRoutingDatastore

Before you begin

How to

Create a multi-node kind cluster

KIND ships with a simple networking implementation (“kindnetd”) based around standard CNI plugins (ptp, host-local, …) and simple netlink routes. You need to disable the default CNI in order to use Calico CNI.

Kind cluster creation can be modified by configuration file. Here you are providing kind configuration in order to disable simple networking implementation (default CNI) and change the pod ip CIDR.

  1. Disable the default CNI in order to use Calico CNI by running the following command:
  1. cat > values.yaml <<EOF
  2. kind: Cluster
  3. apiVersion: kind.x-k8s.io/v1alpha4
  4. nodes:
  5. - role: control-plane
  6. - role: worker
  7. - role: worker
  8. networking:
  9. disableDefaultCNI: true
  10. podSubnet: 192.168.0.0/16
  11. EOF
  1. Start your Kind cluster with one control plane and two worker nodes by running the following command:
  1. kind create cluster --config values.yaml --name dev
  1. Confirm that you now have three nodes in your cluster by running the following command:
  1. kubectl get nodes -o wide

It should return something like the following.

  1. NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
  2. dev-control-plane Ready control-plane 4m v1.25.0 172.18.0.2 <none> Ubuntu 22.04.1 LTS 5.10.0-17-amd64 containerd://1.6.7
  3. dev-worker Ready <none> 4m v1.25.0 172.18.0.4 <none> Ubuntu 22.04.1 LTS 5.10.0-17-amd64 containerd://1.6.7
  4. dev-worker2 Ready <none> 4m v1.25.0 172.18.0.3 <none> Ubuntu 22.04.1 LTS 5.10.0-17-amd64 containerd://1.6.7

Install Calico

  • Operator
  • Manifest
  1. Install the Calico operator and custom resource definitions.
  1. kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.26.4/manifests/tigera-operator.yaml
  1. Install Calico by creating the necessary custom resource. For more information on configuration options available in this manifest, see the installation reference.

Kind multi-node install - 图1note

Before creating this manifest, read its contents and make sure its settings are correct for your environment. For example, if you have replaced pod-network-cidr you must change it in this file as well.

  1. kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.26.4/manifests/custom-resources.yaml

Install Calico by using the following command.

  1. kubectl apply -f https://raw.githubusercontent.com/projectcalico/calico/v3.26.4/manifests/calico.yaml

Kind multi-node install - 图2note

Due to the large size of the CRD bundle, kubectl apply might exceed request limits. Instead, use kubectl create or kubectl replace.

Kind multi-node install - 图3note

You can also view the YAML in a new tab.

You should see the following output.

  1. configmap/calico-config created
  2. customresourcedefinition.apiextensions.k8s.io/bgpconfigurations.crd.projectcalico.org created
  3. customresourcedefinition.apiextensions.k8s.io/bgppeers.crd.projectcalico.org created
  4. customresourcedefinition.apiextensions.k8s.io/blockaffinities.crd.projectcalico.org created
  5. customresourcedefinition.apiextensions.k8s.io/clusterinformations.crd.projectcalico.org created
  6. customresourcedefinition.apiextensions.k8s.io/felixconfigurations.crd.projectcalico.org created
  7. customresourcedefinition.apiextensions.k8s.io/globalnetworkpolicies.crd.projectcalico.org created
  8. customresourcedefinition.apiextensions.k8s.io/globalnetworksets.crd.projectcalico.org created
  9. customresourcedefinition.apiextensions.k8s.io/hostendpoints.crd.projectcalico.org created
  10. customresourcedefinition.apiextensions.k8s.io/ipamblocks.crd.projectcalico.org created
  11. customresourcedefinition.apiextensions.k8s.io/ipamconfigs.crd.projectcalico.org created
  12. customresourcedefinition.apiextensions.k8s.io/ipamhandles.crd.projectcalico.org created
  13. customresourcedefinition.apiextensions.k8s.io/ippools.crd.projectcalico.org created
  14. customresourcedefinition.apiextensions.k8s.io/kubecontrollersconfigurations.crd.projectcalico.org created
  15. customresourcedefinition.apiextensions.k8s.io/networkpolicies.crd.projectcalico.org created
  16. customresourcedefinition.apiextensions.k8s.io/networksets.crd.projectcalico.org created
  17. clusterrole.rbac.authorization.k8s.io/calico-kube-controllers created
  18. clusterrolebinding.rbac.authorization.k8s.io/calico-kube-controllers created
  19. clusterrole.rbac.authorization.k8s.io/calico-node created
  20. clusterrolebinding.rbac.authorization.k8s.io/calico-node created
  21. daemonset.apps/calico-node created
  22. serviceaccount/calico-node created
  23. deployment.apps/calico-kube-controllers created
  24. serviceaccount/calico-kube-controllers created

Verify Calico installation

You can verify Calico installation in your cluster by issuing the following command.

  1. watch kubectl get pods -l k8s-app=calico-node -A

You should see a result similar to the below. Note that the namespace might be different, depending on the method you followed.

  1. NAMESPACE NAME READY STATUS RESTARTS AGE
  2. kube-system calico-node-2xcf4 1/1 Running 0 57s
  3. kube-system calico-node-gkqkg 1/1 Running 0 57s
  4. kube-system calico-node-j44hp 1/1 Running 0 57s

Use ctrl+c to break out of watch.

Congratulations you now have a Kind cluster equipped with Calico

Clean up

Issuing a delete command will destroy the cluster that you created in this tutorial.

  1. kind delete cluster --name dev

Next steps

Required

Recommended tutorials