我一直在尝试建立一个Kubernetes集群,其中已部署的容器应从网络上的DHCP服务器获取其IP地址。
当手动部署这些容器时,我运行以下命令:
INTERFACE="eno2" # Host interface
CONTAINER_ID=$(docker run -d --rm --name="$CONTAINER_NAME" <snip>)
PID=$(docker inspect --format='{{.State.Pid}}' "$CONTAINER_ID")
ip link add link "$INTERFACE" eth1 netns "$PID" type macvlan mode bridge
现在,如果我愿意:
dhclient eth1
在容器上,我可以通过转到eth1上的IP地址来访问该容器。本质上,容器的行为就像是直接连接到网络的物理机(或虚拟机)一样。
我正在尝试使用Kubernetes管理此容器,并且正在尝试使用CNI插件。这是我的/etc/cni/net.d/10-multus.conf:
{
"cniVersion": "0.2.0",
"name": "macvlan-dhcp",
"type": "macvlan",
"master": "eno2",
"isGateway": true,
"ipMasq": true,
"ipam": {
"type": "dhcp"
}
}
但是容器没有启动。我为hello-node应用程序进行了测试部署,并尝试了:
kubectl get deployment hello-node -o yaml
我得到了:
apiVersion: extensions/v1beta1
kind: Deployment
<snip>
status:
conditions:
- lastTransitionTime: 2018-07-23T04:04:25Z
lastUpdateTime: 2018-07-23T04:04:25Z
message: Deployment does not have minimum availability.
reason: MinimumReplicasUnavailable
status: "False"
type: Available
- lastTransitionTime: 2018-07-23T04:14:25Z
lastUpdateTime: 2018-07-23T04:14:25Z
message: ReplicaSet "hello-node-7b788668d8" has timed out progressing.
reason: ProgressDeadlineExceeded
status: "False"
type: Progressing
observedGeneration: 1
replicas: 1
unavailableReplicas: 1
updatedReplicas: 1
我在这里想念什么?