Quickstart for Calico on Kubernetes
Overview
This quickstart gets you a single-host Kubernetes cluster with Calico in approximately 15 minutes. You can use this cluster for testing and development.
To deploy a cluster suitable for production, refer to Installation.
Requirements
- AMD64 processor
- 2CPU
- 2GB RAM
- 10GB free disk space
- RedHat Enterprise Linux 7.x+, CentOS 7.x+, Ubuntu 16.04+, or Debian 9.x+
Before you begin
-
Ensure that Calico can manage
cali
andtunl
interfaces on the host. If NetworkManager is present on the host, refer to Configure NetworkManager. -
Follow the Kubernetes instructions to install kubeadm.
Note: After installing kubeadm, do not power down or restart the host. Instead, continue directly to the next section to create your cluster.
Create a single-host Kubernetes cluster
-
As a regular user with sudo privileges, open a terminal on the host that you installed kubeadm on.
-
Initialize the master using the following command.
sudo kubeadm init --pod-network-cidr=192.168.0.0/16
Note: If 192.168.0.0/16 is already in use within your network you must select a different pod network CIDR, replacing 192.168.0.0/16 in the above command as well as in any manifests applied below.
-
Execute the following commands to configure kubectl (also returned by
kubeadm init
).mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config
-
Install Calico with the following command.
kubectl apply -f https://docs.projectcalico.org/v3.9/manifests/calico.yaml
Note: You can also view the YAML in a new tab.
You should see the following output.
-
Confirm that all of the pods are running with the following command.
watch kubectl get pods --all-namespaces
Wait until each pod has the
STATUS
ofRunning
. -
Press CTRL+C to exit
watch
. -
Remove the taints on the master so that you can schedule pods on it.
kubectl taint nodes --all node-role.kubernetes.io/master-
It should return the following.
-
Confirm that you now have a node in your cluster with the following command.
kubectl get nodes -o wide
It should return something like the following.
Congratulations! You now have a single-host Kubernetes cluster equipped with Calico.
Next steps
Secure a simple application using the Kubernetes NetworkPolicy
API
Control ingress and egress traffic using the Kubernetes NetworkPolicy
API
Create a user interface that shows blocked and allowed connections in real time