본문 바로가기

CKA &. CKAD/Networking

CNI in Kubernetes

Pre-Requisites

 

- Network Namespaces in Linux

- Networking in Docker

- Why and what is Container Network Interface (CNI)?

- CNI Plugins

 

Container Network Interface

 

- Container Runtime must create network namespace

- Identify network the container must attach to

- Container Runtime to invoke Network Plugin (bridge) when container is ADDed

- Container Runtime to invoke Network Plugin (bridge) when container is DELeted.

- JSON format of the Network Configuration

 

Configuring CNI

 

[kubelet_service]

ExecStart=/usr/local/bin/kubelet \\
  --config=/var/lib/kubelet/kubelet-config.yaml \\
  --container-runtime=remote \\
  --container-runtime-endpoint=unix:///var/run/containerd.sock \\
  --image-pull-progress-deadline=2m \\
  --kubeconfig=/var/lib/kubelet/kubeconfig \\
  --network-plugin=cni \\
  --cni-bin-dir=/opt/cni/bin \\
  --cni-conf-dir=/etc/cni/net.d \\
  --register-node=true \\
  --v=2

 

View kubelet option

ps -aux | grep kubelet

 

ls /opt/cni/bin

 

 

ls /etc/cni/net.d

cat /etc/cni/net.d/10-bridge.conf
{
  "cniVersion": "0.2.0",
  "name": "mynet",
  "type": "bridge",
  "bridge": "cni0",
  "isGateway": true,
  "ipMasq": true,
  "ipam": {
    "type": "host-local",
    "subnet": "10.22.0.0/16",
    "routes": [
      { "dst": "0.0.0.0/0" }
    ]
  }
}

※ ipam: ip address management

'CKA &. CKAD > Networking' 카테고리의 다른 글

Practice Test - Explore CNI weave  (0) 2021.03.31
WeaveWorks (CNI)  (0) 2021.03.31
Pod Networking  (0) 2021.03.31
Practice Test - Explore Kubernetes Environments  (0) 2021.03.31
Cluster Networking  (0) 2021.03.30