mirror of
				https://github.com/linuxkit/linuxkit.git
				synced 2025-11-04 08:55:13 +00:00 
			
		
		
		
	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:
		@@ -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 /
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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"}'
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user