Quickstart for Calico on minikube

Big picture

This quickstart gets you a single-node minikube cluster with Calico in approximately 1 minute. You can use this cluster for testing and development.

Value

Use this quickstart to quickly and easily try Calico features.

Before you begin

How to

Create a single-node minikube cluster

  • Built-in Calico
  • Operator
  • Manifest

Minikube offers a built-in Calico implementation, this is a quick way to checkout Calico features.

Quickstart for Calico on minikube - 图1note

Enabling preinstalled Calico might be the quickest way for testing. However, if you like to checkout a more recent version or features of Calico you should consider using Manifest or Operator approach.

  1. minikube start --network-plugin=cni --cni=calico

Start your minikube cluster with one master node using the following command.

Quickstart for Calico on minikube - 图2note

If 192.168.0.0/16 is already in use within your network you must select a different pod network CIDR, by replacing 192.168.0.0/16 in the following command.

  1. minikube start --network-plugin=cni --extra-config=kubeadm.pod-network-cidr=192.168.0.0/16

Install the Tigera Calico operator and custom resource definitions.

  1. kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.24.5/manifests/tigera-operator.yaml

Install Calico by creating the necessary custom resource. For more information on configuration options available in this manifest, see the installation reference.

Quickstart for Calico on minikube - 图3note

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.24.5/manifests/custom-resources.yaml

Start your minikube cluster with one master node using the following command.

  1. minikube start --network-plugin=cni

Install Calico.

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

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-mlqvs 1/1 Running 0 5m18s

Use ctrl+c to break out of watch.

Congratulations you now have a minikube cluster equipped with Calico

Add an additional worker node

Quickstart for Calico on minikube - 图4note

This as an optional step, you can safely skip this step if you do not require an additional worker node.

  1. minikube node add

Verify nodes using the following command

  1. kubectl get nodes

Clean up

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

  1. minikube delete

Next steps

Required

Recommended tutorials