Sobes.tech
Middle

What CNI plugin was used? Tell us about the Calico configuration.

sobes.tech AI

Answer from AI

In Kubernetes projects, I used the Calico CNI plugin to ensure network policy and routing.

Calico is a network plugin that provides:

  • Packet routing at L3 without the need for overlay networks (although it supports overlays).
  • Support for Kubernetes network policies to control access between pods.
  • High performance and scalability.

Configuring Calico usually involves:

  1. Installing Calico components via manifests or Helm.
  2. Configuring IP pools from which Calico allocates IPs for pods.
  3. Defining network policies to restrict traffic between pods.
  4. Setting up BGP or IP-in-IP tunnels for routing between nodes.

An example of a basic setup:

kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml

After installation, you can create network policies, for example, to allow traffic only from certain pods:

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: allow-nginx
spec:
  podSelector:
    matchLabels:
      app: nginx
  ingress:
  - from:
    - podSelector:
        matchLabels:
          role: frontend

Thus, Calico provides flexible and secure network interaction within a Kubernetes cluster.