I have been trying to setup a Kubernetes cluster where deployed containers should get their IP address from the DHCP server on the network.
When deploying these containers manually, I run the following commands :
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
Now if I do :
dhclient eth1
on the container, I can reach the container by going to the IP address on eth1. Essentially, the container behaves as if it was a physical machine ( or a virtual machine ) connected directly to the network.
I am trying to manage this container using Kubernetes, and I am trying to use CNI plugins. Here is my /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"
}
}
But containers are not starting up. I did a test deployment for hello-node application and tried :
kubectl get deployment hello-node -o yaml
and I am getting :
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
What am I missing here ?