nixos/kubernetes: bootstrap docker without networking

Before flannel is ready there is a brief time where docker will be
running with a default docker0 bridge. If kubernetes happens to spawn
containers before flannel is ready, docker can't be restarted when
flannel is ready because some containers are still running on the
docker0 bridge with potentially different network addresses.

Environment variables in `EnvironmentFile` override those defined via
`Environment` in the systemd service config.

Co-authored-by: Christian Albrecht <christian.albrecht@mayflower.de>
This commit is contained in:
Franz Pletz 2019-02-20 20:52:36 +01:00
parent 6045068f6c
commit 3a02205496
No known key found for this signature in database
GPG key ID: 846FDED7792617B4

View file

@ -66,7 +66,10 @@ in
};
};
systemd.services.docker.serviceConfig.EnvironmentFile = "/run/flannel/docker";
systemd.services.docker = {
environment.DOCKER_OPTS = "-b none";
serviceConfig.EnvironmentFile = "/run/flannel/docker";
};
# read environment variables generated by mk-docker-opts
virtualisation.docker.extraOptions = "$DOCKER_OPTS";