gpt4 book ai didi

kubernetes - 使用 multus-cni 添加的 IP 地址无法从同一集群中的另一个 pod 访问

转载 作者:行者123 更新时间:2023-12-02 12:29:57 25 4
gpt4 key购买 nike

我正在使用 multus-cni 在我的 pod 中创建多个接口(interface)。我配置了 weave-net CNI,因此 pod 提供了集群 ip 10.32.x.x。使用下面的 network-attachment-definition ,我可以在一个 IP 地址为 10.32.0.180-199 的 Pod 内启动多个接口(interface),但这些 IP 地址无法从同一集群中的其他 Pod 访问。如果我在另一个 pod 中执行 kubectl exec 并 ping 10.32.0.180,我将无法 ping 该 IP。

谁能告诉我需要做什么才能在集群中访问 pod 中的其他接口(interface)?

apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: macvlan-conf
spec:
config: '{
"cniVersion": "0.3.0",
"type": "macvlan",
"master": "{{ .Values.global.interfaceName }}",
"mode": "bridge",
"ipam": {
"type": "host-local",
"subnet": "10.32.0.0/16",
"rangeStart": "10.32.0.180",
"rangeEnd": "10.32.0.199",
"routes": [
{ "dst": "0.0.0.0/0" }
],
"gateway": "10.32.0.1"
}
}'


kubectl version
Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.0", GitCommit:"ddf47ac13c1a9483ea035a79cd7c10005ff21a6d", GitTreeState:"clean", BuildDate:"2018-12-03T21:04:45Z", GoVersion:"go1.11.2", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.0", GitCommit:"ddf47ac13c1a9483ea035a79cd7c10005ff21a6d", GitTreeState:"clean", BuildDate:"2018-12-03T20:56:12Z", GoVersion:"go1.11.2", Compiler:"gc", Platform:"linux/amd64"}

最佳答案

我使用了似乎运行良好的主机设备

apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: host-1
spec:
config: '{
"cniVersion": "0.3.1",
"type": "host-device",
"device": "enp0s8"
}'

关于kubernetes - 使用 multus-cni 添加的 IP 地址无法从同一集群中的另一个 pod 访问,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59379688/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com