1

我正在尝试使用 multus-cni 部署具有第二个接口的 pod。但是,当我部署我的 pod 时,我只看到一个接口是主接口。不创建辅助接口。

我按照快速入门指南中的步骤安装 multus。

环境:Microsoft Windows 10 Enterprise Kubernetes v1.18.3 on Docker 19.03.12 上的 minikube v1.12.1

多版本 --cni-version=0.3.1

$00-multus.conf

{ "cniVersion": "0.3.1", "name": "multus-cni-network", "type": "multus", "kubeconfig": "/etc/cni/net.d/multus.d/multus.kubeconfig", "delegates": [ { "cniVersion": "0.3.1", "name":
"bridge", "type": "bridge", "bridge": "bridge", "addIf": "true", "isDefaultGateway": true, "forceAddress": false, "ipMasq": true, "hairpinMode": true, "ipam": { "type": "host-local
", "subnet": "10.244.0.0/16" } } ] }

$1-k8s.conf

{
"cniVersion": "0.3.1",
"name": "bridge",
"type": "bridge",
"bridge": "bridge",
"addIf": "true",
"isDefaultGateway": true,
"forceAddress": false,
"ipMasq": true,
"hairpinMode": true,
"ipam": {
"type": "host-local",
"subnet": "10.244.0.0/16"
}
}

$87-podman-bridge.conflist

{
"cniVersion": "0.4.0",
"name": "podman",
"plugins": [
{
"type": "bridge",
"bridge": "cni-podman0",
"isGateway": true,
"ipMasq": true,
"hairpinMode": true,
"ipam": {
"type": "host-local",
"routes": [{ "dst": "0.0.0.0/0" }],
"ranges": [
[
{
"subnet": "10.88.0.0/16",
"gateway": "10.88.0.1"
}
]
]
}
},
{
"type": "portmap",
"capabilities": {
"portMappings": true
}
},
{
"type": "firewall"
},
{
"type": "tuning"
}
]
}

$multus.kubeconfig

apiVersion: v1
kind: Config
clusters:
- name: local
  cluster:
    server: https://[10.96.0.1]:443
    certificate-authority-data: .....
users:
- name: multus
  user:
    token: .....
contexts:
- name: multus-context
  context:
    cluster: local
    user: multus
current-context: multus-context

File of '/etc/cni/multus/net.d'

**NetworkAttachment info:**

    cat <<EOF | kubectl create -f -
    apiVersion: "k8s.cni.cncf.io/v1"
    kind: NetworkAttachmentDefinition
    metadata:
    name: macvlan-conf
    spec:
    config: '{
    "cniVersion": "0.3.1",
    "type": "macvlan",
    "master": "eth1",
    "mode": "bridge",
    "ipam": {
    "type": "host-local",
    "subnet": "192.168.1.0/24",
    "rangeStart": "192.168.1.200",
    "rangeEnd": "192.168.1.216",
    "routes": [
    { "dst": "0.0.0.0/0" }
    ],
    "gateway": "192.168.1.1"
    }
    }'
    EOF

Pod yaml 信息:

cat <<EOF | kubectl create -f -
apiVersion: v1
kind: Pod
metadata:
name: samplepod
annotations:
k8s.v1.cni.cncf.io/networks: macvlan-conf
spec:
containers:
    name: samplepod
    command: ["/bin/ash", "-c", "trap : TERM INT; sleep infinity & wait"]
    image: alpine
    EOF
4

1 回答 1

1

我安装了新的 minikube 版本,现在添加辅助接口似乎没问题。

于 2020-09-20T21:10:58.983 回答