I have a application running with kubernetes orchestrator. I want to implement calico network policy on the basis of CIDR so that I can control the pod's traffic (incoming and outgoing). I am looking for prerequisite installation (any plugin) and what changes (calico yaml file or manifest file) are required to achieve this.
Some explanation about steps that need to be implemented will be appreciated.
well, prerequisites depend on whether you want to use plain Kubernetes NetworkPolicies or Calico NetworkPolicies.
You will need to have a CNI Plugin deployed which implements the NetworkPolicy Specification either way. Calicao supports plain NetPols as well as its own NetPol implementation.
By default as explained here K3s is running with flannel CNI, using VXLAN as default backend.
To change the CNI you need to run K3s
with --flannel-backend=none
. For more information please visit custom-CNI section of the docs.
Please note that besides calico you can run canal CNI which in fact is flannel with calico network policies available.