[k8s] CNI

tags: kubernetes network
  • Container Network Interface (CNI) was accepted to CNCF on May 23, 2017 and is at the Incubating project maturity level.
  • 由一组用於配置 Linux 容器的network interface的spec和library组成,同時還包含了一些插件
  • CNI 僅關心容器創建時的網路分配,和當容器被刪除時釋放網路資源。
    • 當有問題時,有可能出現「unable to allocate IP address」

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

常見的cni plugins

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

這些 CNI Plugin 都是由 CNI 專案所提供的基本功能,其目的非常簡單,就是提供最簡單且單一的網路架構

so that your Pods can communicate with each other.

configuring CNI

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

當 kubelet 在建立 Pod 的時候,會透過 CNI 來讓 Pod 成功設定好網路

  • cni-bin-dir (預設 /opt/cni/bin):存放各種 CNI Plugin 執行檔案的位置,例如上面提到的配置網路,刪除網路,分配 IP 位址的功能
  • cni-conf-dir (預設 /etc/cni/net.d):存放 CNI 的組態檔案,讓 kubelet 知道 Pod 在設定網路時,需要透過哪一些 Plugin 來完成

Note:
Prior to Kubernetes 1.24, the CNI plugins could also be managed by the kubelet using the cni-bin-dir and network-plugin command-line parameters. These command-line parameters were removed in Kubernetes 1.24, with management of the CNI no longer in scope for kubelet.

WeaveWorks

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →