我正在使用multus-cni在我的pod中创建多个接口。我已经配置了编织网 CNI,因此 pod 提供集群 ip 10.32.x.x。使用以下网络附件定义,我能够在 Pod 内启动多个接口,IP 地址为 10.32.0.180-199,但这些 IP 地址无法从同一集群中的其他 Pod 访问。如果我将 kubectl exec 执行到另一个 pod,并 ping 10.32.0.180,我将无法 ping 该 IP。
谁能告诉我需要做什么才能在集群中访问 Pod 中的其他接口?
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"
}'