Skip to main content
Which is better for your cluster: Flannel or Canal? Bob sets out to answer that question by running the same experiment on two clusters:
  • Cluster one runs Flannel.
  • Cluster two runs Canal (Flannel + Calico).
Both plugins aim to give Pods a network and connect Pods across nodes, but they differ in capability—most importantly in how (or whether) they enforce Kubernetes NetworkPolicy. What follows is a concise explanation of the differences, then the exact steps Bob uses to test them so you can reproduce the experiment.

What Flannel does

Flannel (originally from CoreOS) is designed for simplicity. It creates an overlay network so Pods behave as if they are on the same flat network even when they live on different nodes. Because Flannel runs on top of the host network, it’s easy to set up and doesn’t require special hardware. However, Flannel by itself does not implement NetworkPolicy enforcement. That means NetworkPolicy objects you create in the Kubernetes API server are only effective if a CNI datapath that supports policy enforcement is present (for example, Calico or Cilium).
NetworkPolicy objects are API resources only. They only take effect if the underlying CNI plugin (or an additional datapath) enforces them. If the CNI lacks policy enforcement, policies are accepted by Kubernetes but do nothing.

What Canal is

Canal packages two pieces:
  • Flannel — provides the simple overlay network.
  • Calico — provides policy enforcement and other datapath features.
Canal combines Flannel’s overlay with Calico’s NetworkPolicy enforcement so you get easy networking plus real policy controls.

Bob’s experiment (reproducible steps)

Bob uses identical workloads and tests on both clusters. The only difference is the installed CNI:
  1. Deploy two nginx Pods in the default namespace on each cluster.
    • Cluster one: Pods named KodeKloud and Community.
    • Cluster two: Pods named Alpha and Beta.
  2. Test connectivity by running curl from one Pod to the other Pod’s IP.
  3. Apply a deny-all NetworkPolicy to the default namespace on both clusters.
  4. Re-run the same curl tests.
Example of running curl from inside a pod:
If the welcome page is returned, the two pods can reach each other.

The deny-all NetworkPolicy

Bob applies the same policy YAML to both clusters:
  • podSelector: {} selects all pods in the namespace.
  • policyTypes includes both Ingress and Egress so the policy governs incoming and outgoing traffic.
  • Empty ingress: [] and egress: [] effectively allow no traffic to/from the selected pods.
Apply it with:
Then re-run the curl tests from the same pods.

Key questions Bob wants to answer

  • What is the role of the CNI?
    • The CNI standardizes how container networking is configured. Individual CNI plugins implement datapath behavior and may optionally enforce NetworkPolicy.
  • Which plugin is running on cluster one?
    • Flannel.
  • Which plugin actually enforces NetworkPolicy?
    • Calico (or another policy-capable CNI such as Cilium) enforces NetworkPolicy. Flannel on its own does not.

Quick comparison

Expected vs. actual behavior

  • Before the deny-all policy: curl tests should succeed on both clusters (Kubernetes allows pod-to-pod traffic by default).
  • After applying deny-all:
    • On the Canal cluster (Flannel + Calico): NetworkPolicy enforcement should block the curl requests.
    • On the Flannel-only cluster: Because Flannel does not enforce NetworkPolicy, the curl requests may still succeed even though the deny-all object exists in the API.
Applying a NetworkPolicy object does not guarantee traffic is blocked. If your cluster’s CNI plugin does not implement policy enforcement, the NetworkPolicy resource will be ignored at datapath time. Always verify behavior after applying policies.
Everything else in the experiment (Pods, test method, policy file) is identical between clusters; the only variable is the CNI implementation. So once deny-all is applied, will curl still return the welcome page? The answer depends on whether the CNI enforces NetworkPolicy—on Flannel-only it likely will, on Canal it should not.

Watch Video