Open jerrykan opened 7 years ago
I believe the documentation is outdated. I'm having a lot of trouble with DNS following the official guide. Nothing seems to work.
Oops, I've just noticed this is a duplicate of #872, although with a different solution.
I've run into the same issue. Very disgusting.
My solution for CoreOS Cloud-Config. I deleted the docker_opts_cni.env and added this to the 40-flannel.conf. Maybe the service file could written in a better way but it works for me.
- path: /etc/systemd/system/docker.service.d/40-flannel.conf
permissions: 0644
owner: root
content: |
[Unit]
Requires=flanneld.service
After=flanneld.service
[Service]
EnvironmentFile=/run/flannel/subnet.env
ExecStartPre=export DOCKER_OPT_BIP="--bip=${FLANNEL_SUBNET}"
Maybe something like this is also necessary
ExecStartPre=export DOCKER_OPT_IPMASQ="--ip-masq=${FLANNEL_IPMASQ}"
After appending $DOCKER_NETWORK_OPTIONS
which is defined in /run/flannel/docker
to docker's systemd ExecStart
, such as ExecStart=/usr/bin/dockerd -H fd:// $DOCKER_NETWORK_OPTIONS
.
Now IP of docker0
is correctly set.
In the documentation it says to create a drop-in containing the following:
And a
/etc/kubernetes/cni/docker_opts_cni.env
file containing the following:But it seems that these environment variables only seems nullify the environment variables in
/var/run/flannel/flannel_docker_opts.env
and cause docker to use its default IPs (ie. pods come up with a172.17.0.x
address. Commenting out theEnvironmentFile
line in the drop-in and restarting docker causes the pods to then pick up a10.2.x.x
IP.Is the documentation incorrect? or am I missing something?