10.4.3 验证CNI插件链配置

登录到Kubernetes集群的任一节点上,进入目录/etc/cni/net.d中,可以查看由服务账户信息创建Istio CNI插件的kubeconf ig文件,以及为Istio CNI构建的插件链配置文件。

如下示例假设Kubernetes集群使用了f lannel网络插件,在没有启用Istio CNI插件的情况下,登录到Kubernetes集群的任一节点机器上,可以查看f lannel网络插件对应的配置,如下所示:


[root@iZ2zebvn3cjkeqg7lghn1wZ net.d]# ls
10-flannel.conf
[root@iZ2zebvn3cjkeqg7lghn1wZ net.d]# cat 10-flannel.conf
{
  "name": "cb0",
  "type": "flannel",
  "delegate": {
    "isDefaultGateway": true
  }
}

在启用了Istio CNI插件的情况下,再次登录到Kubernetes集群的任一节点上,则可以看到网络插件的配置发生了变化,如下是一个变更后的CNI插件链配置的示例内容:


[root@iZbp1csxy0jrgmmti2o532Z net.d]# ls
10-flannel.conflist  ZZZ-istio-cni-kubeconfig
[root@iZbp1csxy0jrgmmti2o532Z net.d]# cat 10-flannel.conflist
{
  "plugins": [
    {
      "name": "cb0",
      "type": "flannel",
      "delegate": {
        "isDefaultGateway": true
      }
    },
    {
      "type": "istio-cni",
      "log_level": "info",
      "kubernetes": {
        "kubeconfig": "/etc/cni/net.d/ZZZ-istio-cni-kubeconfig",
        "cni_bin_dir": "/opt/cni/bin",
        "exclude_namespaces": [
          "istio-system"
        ]
      }
    }
  ],
  "name": "k8s-pod-network",
  "cniVersion": "0.3.0"
}