kubernetes: Adjust for /var/run->/run symlink

PR #2314 turned /var into a tmpfs (possibly overmounted by a persistent disk)
and made /var/run into a symlink to /run. Adjust various containers and bind
mount settings to allow for this change. In particular ensuring that everything
can find the correct shared /var/run/docker.sock, which due to the symlink is
now actually at /run.

Signed-off-by: Ian Campbell <ijc@docker.com>
This commit is contained in:
Ian Campbell 2017-08-01 15:52:11 +01:00
parent e2ef7c0055
commit fcd5afa152
4 changed files with 7 additions and 1 deletions

View File

@ -12,6 +12,8 @@ RUN apk add --no-cache --initdb -p /out \
# Remove apk residuals. We have a read-only rootfs, so apk is of no use.
RUN rm -rf /out/etc/apk /out/lib/apk /out/var/cache
RUN rmdir /out/var/run && ln -nfs /run /out/var/run
FROM scratch
WORKDIR /
COPY --from=build /out /

View File

@ -51,6 +51,7 @@ services:
- /dev:/dev
- /etc/resolv.conf:/etc/resolv.conf
- /lib/modules:/lib/modules
- /run:/run:rshared,rbind
- /var:/var:rshared,rbind
- /var/lib/kubeadm:/etc/kubernetes
- /etc/cni:/etc/cni:rshared,rbind

View File

@ -51,6 +51,7 @@ services:
- /dev:/dev
- /etc/resolv.conf:/etc/resolv.conf
- /lib/modules:/lib/modules
- /run:/run:rshared,rbind
- /var:/var:rshared,rbind
- /var/lib/kubeadm:/etc/kubernetes
- /etc/cni:/etc/cni:rshared,rbind

View File

@ -30,6 +30,8 @@ RUN apk add --no-cache --initdb -p /out \
# Remove apk residuals. We have a read-only rootfs, so apk is of no use.
RUN rm -rf /out/etc/apk /out/lib/apk /out/var/cache
RUN rmdir /out/var/run && ln -nfs /run /out/var/run
RUN curl -fSL -o /tmp/cni.tgz https://github.com/containernetworking/cni/releases/download/v0.5.2/cni-amd64-${cni_version}.tgz && \
mkdir -p /out/opt/cni/bin /out/etc/cni/net.d && \
tar -xzf /tmp/cni.tgz -C /out/opt/cni/bin
@ -47,4 +49,4 @@ WORKDIR /
ENTRYPOINT ["/usr/bin/kubelet.sh"]
COPY --from=build /out /
ENV KUBECONFIG "/etc/kubernetes/admin.conf"
LABEL org.mobyproject.config='{"binds": ["/dev:/dev", "/etc/resolv.conf:/etc/resolv.conf", "/var:/var:rshared,rbind", "/var/lib/kubeadm:/etc/kubernetes", "/etc/cni:/rootfs/etc/cni:rshared,rbind", "/opt/cni:/rootfs/opt/cni:rshared,rbind"], "mounts": [{"type": "cgroup", "options": ["rw","nosuid","noexec","nodev","relatime"]}], "capabilities": ["all"], "rootfsPropagation": "shared", "pid": "host"}'
LABEL org.mobyproject.config='{"binds": ["/dev:/dev", "/etc/resolv.conf:/etc/resolv.conf", "/run:/run", "/var:/var:rshared,rbind", "/var/lib/kubeadm:/etc/kubernetes", "/etc/cni:/rootfs/etc/cni:rshared,rbind", "/opt/cni:/rootfs/opt/cni:rshared,rbind"], "mounts": [{"type": "cgroup", "options": ["rw","nosuid","noexec","nodev","relatime"]}], "capabilities": ["all"], "rootfsPropagation": "shared", "pid": "host"}'