Skip to main content
How does a CNI (Container Network Interface) plugin get installed onto a Kubernetes cluster? With a single command. Most CNIs (including Flannel and Canal) are installed by applying a manifest: a YAML file that declares one or more Kubernetes objects. You give that file to kubectl apply, and Kubernetes creates everything declared inside. For CNIs the most important object in these manifests is a DaemonSet. A DaemonSet ensures one copy of a pod runs on each node — exactly what a networking plugin needs so every node receives a pod network.
Once a DaemonSet is created, every node runs the plugin pod and therefore gets configured with the pod network the CNI provides. In this guide we use the official manifests for Flannel and Canal. Always get the manifest URL from the plugin’s official install page:
Before applying manifests, make sure your kubectl commands target the correct cluster context.You can either:
  • add --context to each kubectl command, e.g. kubectl --context=cluster1 get nodes, or
  • switch contexts once with kubectl config use-context cluster1 so subsequent commands go to that cluster.

Step 1 — Install Flannel on cluster1

Switch to cluster1 and apply the Flannel manifest (replace the example URL with the official Flannel manifest URL if it changes):
Kubernetes creates the Flannel objects and the DaemonSet. One Flannel pod will be scheduled on each node. For example, if cluster1 has three nodes, three Flannel pods appear. Within a few moments the node statuses should change. kubectl get nodes will show nodes as Ready. Why does this happen? The kubelet (the node agent) needs the pod network provided by a CNI plugin to finish configuring pod networking. Once the CNI is available, the kubelet completes setup and the node transitions from NotReady to Ready. Deployments or pods that were waiting for a network can now be scheduled and will move to Running:

Step 2 — Install Canal on cluster2

Switch to cluster2 and apply the Canal manifest (again, use the official manifest URL if changed):
Canal also runs as a DaemonSet, so one pod starts on each node. If cluster2 has two nodes, you’ll see two Canal pods. The nodes will move from NotReady to Ready as the CNI becomes available, and any previously unschedulable pods will reach Running.

Verification checklist

Bob verifies the clusters:
  • On cluster1 list pods across all namespaces and confirm three Flannel pods are Running.
    Example:
    • kubectl --context=cluster1 get pods -A
  • On cluster2 list pods and confirm two Canal pods are Running.
    Example:
    • kubectl --context=cluster2 get pods -A
  • All five nodes (three in cluster1, two in cluster2) now report Ready.
  • Deployment A pods and Pod B are Running.
Now both clusters have working pod networking; externally they look the same: nodes are Ready and pods are Running.

CNI differences and NetworkPolicy

Note that different CNIs have different feature sets. In particular, support for Kubernetes NetworkPolicy depends on the plugin:
Note: Applying the same NetworkPolicy to both clusters does not guarantee identical behavior. One cluster may actively enforce policies, while another may accept and store them without enforcing. Always confirm NetworkPolicy support in the CNI documentation before relying on policies for network isolation.

Summary

  • A CNI is typically installed by applying a manifest that includes a DaemonSet, which ensures one plugin pod per node.
  • Use kubectl config use-context <context> or --context to point kubectl at the correct cluster before applying manifests.
  • After installing a CNI, nodes should move to Ready and pods will be scheduled normally.
  • Choose a CNI that matches your feature needs (for example, NetworkPolicy enforcement).

Watch Video

Practice Lab