首页 > 解决方案 > 在 Azure 但在非 AKS Kubernetes 环境/Kubernetes Baremetal 安装中需要 Azure CNI 的问题或帮助

问题描述

我找到了这个 cni 和插件,我目前正在使用 docker 在 azure 上的 kubernetes v1.20.5 裸机安装中对其进行测试。我们不使用 aks azure 服务,因为我们想在我们的一个客户的 prem vmware 环境中学习和部署以后的 kubernetes,但是我们会在那里使用不同的 cni,比如 flannel 或 weave。flannel 和 weave 在 azure 上不起作用,这就是我使用 azure cni 插件的原因。

我的测试环境:

我下面的 ipam 配置无法正常工作。我需要添加第二个网卡

{
   "cniVersion":"0.3.0",
   "name":"azure",
   "plugins":[
      {
         "type":"azure-vnet",
         "mode":"transparent",
         "ipsToRouteViaHost":["169.254.20.10"],
         "ipam": {
           "type": "host-local",
           "subnet": "10.1.0.0/16",
           "gateway": "10.1.0.1"
         },
         "dns": {
           "nameservers": [ "10.1.0.1" ]
         }
      },
      {
         "type":"portmap",
         "capabilities":{
            "portMappings":true
         },
         "snat":true
      }
   ]
}

尾 -f /var/log/azure-vnet.log

2021/03/30 12:23:11 [41456] [cni] reboot time 2021-03-29 23:16:00 +0000 UTC
2021/03/30 12:23:11 [41456] Connected to telemetry service
2021/03/30 12:23:11 [41456] [cni-net] Plugin azure-vnet version v1.2.8.
2021/03/30 12:23:11 [41456] [cni-net] Running on Linux version 4.18.0-147.43.1.el8_1.x86_64 (mockbuild@x86-vm-08.build.eng.bos.redhat.com) (gcc version 8.3.1 20190507 (Red Hat 8.3.1-4) (GCC)) #1 SMP Thu Feb 18 08:33:46 EST 2021
2021/03/30 12:23:11 [41456] [Azure-Utils] iptables --version
2021/03/30 12:23:11 [41456] [cni-net] iptable version:iptables v1.8.2 (nf_tables), err:<nil>
2021/03/30 12:23:11 [41456] [Azure-Utils] ebtables --version
2021/03/30 12:23:11 [41456] [cni-net] ebtable version ebtables 1.8.2 (nf_tables), err:<nil>
2021/03/30 12:23:11 [41456] [net] Network interface: {Index:1 MTU:65536 Name:lo HardwareAddr: Flags:up|loopback} with IP: [127.0.0.1/8]
2021/03/30 12:23:11 [41456] [net] Network interface: {Index:2 MTU:1500 Name:eth0 HardwareAddr:00:0d:3a:6c:c0:0c Flags:up|broadcast|I would be very grateful if someone would help me, as I'm slowly going insanemulticast} with IP: [192.168.0.7/24]
2021/03/30 12:23:11 [41456] [net] Network interface: {Index:3 MTU:1500 Name:eth1 HardwareAddr:00:0d:3a:f5:cb:22 Flags:up|broadcast|multicast} with IP: [10.1.1.10/16]
2021/03/30 12:23:11 [41456] [net] Network interface: {Index:4 MTU:1500 Name:docker0 HardwareAddr:02:42:0f:16:a8:5e Flags:up|broadcast|multicast} with IP: [172.17.0.1/16]
2021/03/30 12:23:11 [41456] [net] network store key not found
2021/03/30 12:23:11 [41456] [cni-net] Plugin started.
2021/03/30 12:23:11 [41456] CNI_COMMAND environment variable set to VERSION
2021/03/30 12:23:11 [41456] [cni-net] Plugin stopped

尾 -f /var/log/azure-vnet-ipam.log

2021/03/29 22:37:18 [10282] [Utils] Initializing HTTP client with connection timeout: 10, response header timeout: 10
2021/03/29 22:37:18 [10282] [ipam] Wireserver call http://168.63.129.16/machine/plugins?comp=nmagent&type=getinterfaceinfov1 to retrieve IP List
2021/03/29 22:37:18 [10282] [ipam] got 0 addresses from interface eth0, subnet 192.168.0.0/24
2021/03/29 22:37:18 [10282] [ipam] got 0 addresses from interface eth1, subnet 10.1.0.0/16
2021/03/29 22:37:18 [10282] [ipam] merging address space
2021/03/29 22:37:18 [10282] [ipam] saving ipam state.
2021/03/29 22:37:18 [10282] [ipam] Save succeeded.
2021/03/29 22:37:18 [10282] [azure-vnet-ipam] Failed to release address: Pool id  not found :Invalid address pool.
2021/03/29 22:37:18 [10282] [cni-ipam] DEL command completed with err:Failed to release address: Pool id  not found :Invalid address pool.
2021/03/29 22:37:18 [10282] [cni-ipam] Plugin stopped.

以下是我的问题:

  1. 我的配置在顶部吗?还是我理解错了?
  2. 这仅在我将 azure 上的多个 ip 地址添加到第二个 nic(eth1,子网 10.1.0.0/16)时才有效,但我希望有所不同。但我不想那样做!!!:-(
  3. 如果我对您的文档的理解正确,我希望该插件会在第二个 nic 上创建、添加和删除 ipadresses?

如果有人能帮助我,我将非常感激,因为我正在慢慢发疯^^

提前谢谢

标签: azurekubernetes

解决方案


推荐阅读