mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-21 10:09:07 +00:00
kubernetes: populate host CNI paths by binding from kubernetes service.
Kubernetes assumes (for now) that various paths are valid at the host level to be mounted into containers, including /opt/cni and /etc/cni. We cannot (easily) use symlinks here because the weave.yml mounts /opt and /etc rather than /opt/cni and /etc/cni (this seems likely to be common pattern). So if /etc/cni were a symlink to the persistent disk (under /var/lib) then it will be dangling link within the weave container. So add bind mounts to the runtime configuration of the kubernetes image. This also means we must create the target mount points in the yml. Signed-off-by: Ian Campbell <ijc@docker.com>
This commit is contained in:
parent
07e4f515a4
commit
9397b9480a
@ -60,6 +60,10 @@ services:
|
||||
- name: kubelet
|
||||
image: linuxkitprojects/kubernetes:c4a6ae5121df50471ad244b9fc153ff5eb674fb2
|
||||
files:
|
||||
- path: /opt/cni
|
||||
directory: true
|
||||
- path: /etc/cni
|
||||
directory: true
|
||||
- path: root/.ssh/authorized_keys
|
||||
source: ~/.ssh/id_rsa.pub
|
||||
mode: "0600"
|
||||
|
@ -58,6 +58,10 @@ services:
|
||||
- name: kubelet
|
||||
image: linuxkitprojects/kubernetes:c4a6ae5121df50471ad244b9fc153ff5eb674fb2
|
||||
files:
|
||||
- path: /opt/cni
|
||||
directory: true
|
||||
- path: /etc/cni
|
||||
directory: true
|
||||
- path: root/.ssh/authorized_keys
|
||||
source: ~/.ssh/id_rsa.pub
|
||||
mode: "0600"
|
||||
|
@ -45,4 +45,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", "/run:/run", "/var:/var:rshared,rbind", "/var/lib/kubeadm:/etc/kubernetes"], "mounts": [{"type": "cgroup", "options": ["rw","nosuid","noexec","nodev","relatime"]}], "capabilities": ["all"], "rootfsPropagation": "shared", "pid": "host", "runtime": {"mkdir": ["/var/lib/kubeadm", "/var/lib/cni/etc", "/var/lib/cni/opt"]}}'
|
||||
LABEL org.mobyproject.config='{"binds": ["/dev:/dev", "/etc/resolv.conf:/etc/resolv.conf", "/run:/run", "/var:/var:rshared,rbind", "/var/lib/kubeadm:/etc/kubernetes"], "mounts": [{"type": "cgroup", "options": ["rw","nosuid","noexec","nodev","relatime"]}], "capabilities": ["all"], "rootfsPropagation": "shared", "pid": "host", "runtime": {"mkdir": ["/var/lib/kubeadm", "/var/lib/cni/etc", "/var/lib/cni/opt"], "mounts": [{"type": "bind", "source": "/var/lib/cni/opt", "destination": "/opt/cni", "options": ["rw", "bind"]}, {"type": "bind", "source": "/var/lib/cni/etc", "destination": "/etc/cni", "options": ["rw", "bind"]}]}}'
|
||||
|
Loading…
Reference in New Issue
Block a user