mirror of
				https://github.com/linuxkit/linuxkit.git
				synced 2025-11-04 09:07:15 +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.
 | 
					# 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 rm -rf /out/etc/apk /out/lib/apk /out/var/cache
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RUN rmdir /out/var/run && ln -nfs /run /out/var/run
 | 
				
			||||||
 | 
					
 | 
				
			||||||
FROM scratch
 | 
					FROM scratch
 | 
				
			||||||
WORKDIR /
 | 
					WORKDIR /
 | 
				
			||||||
COPY --from=build /out /
 | 
					COPY --from=build /out /
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -51,6 +51,7 @@ services:
 | 
				
			|||||||
     - /dev:/dev
 | 
					     - /dev:/dev
 | 
				
			||||||
     - /etc/resolv.conf:/etc/resolv.conf
 | 
					     - /etc/resolv.conf:/etc/resolv.conf
 | 
				
			||||||
     - /lib/modules:/lib/modules
 | 
					     - /lib/modules:/lib/modules
 | 
				
			||||||
 | 
					     - /run:/run:rshared,rbind
 | 
				
			||||||
     - /var:/var:rshared,rbind
 | 
					     - /var:/var:rshared,rbind
 | 
				
			||||||
     - /var/lib/kubeadm:/etc/kubernetes
 | 
					     - /var/lib/kubeadm:/etc/kubernetes
 | 
				
			||||||
     - /etc/cni:/etc/cni:rshared,rbind
 | 
					     - /etc/cni:/etc/cni:rshared,rbind
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -51,6 +51,7 @@ services:
 | 
				
			|||||||
     - /dev:/dev
 | 
					     - /dev:/dev
 | 
				
			||||||
     - /etc/resolv.conf:/etc/resolv.conf
 | 
					     - /etc/resolv.conf:/etc/resolv.conf
 | 
				
			||||||
     - /lib/modules:/lib/modules
 | 
					     - /lib/modules:/lib/modules
 | 
				
			||||||
 | 
					     - /run:/run:rshared,rbind
 | 
				
			||||||
     - /var:/var:rshared,rbind
 | 
					     - /var:/var:rshared,rbind
 | 
				
			||||||
     - /var/lib/kubeadm:/etc/kubernetes
 | 
					     - /var/lib/kubeadm:/etc/kubernetes
 | 
				
			||||||
     - /etc/cni:/etc/cni:rshared,rbind
 | 
					     - /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.
 | 
					# 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 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 && \
 | 
					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 && \
 | 
					    mkdir -p /out/opt/cni/bin /out/etc/cni/net.d && \
 | 
				
			||||||
    tar -xzf /tmp/cni.tgz -C /out/opt/cni/bin
 | 
					    tar -xzf /tmp/cni.tgz -C /out/opt/cni/bin
 | 
				
			||||||
@@ -47,4 +49,4 @@ WORKDIR /
 | 
				
			|||||||
ENTRYPOINT ["/usr/bin/kubelet.sh"]
 | 
					ENTRYPOINT ["/usr/bin/kubelet.sh"]
 | 
				
			||||||
COPY --from=build /out /
 | 
					COPY --from=build /out /
 | 
				
			||||||
ENV KUBECONFIG "/etc/kubernetes/admin.conf"
 | 
					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