From 466e5db2033bdf4fc4d93fc686d77a22ed112dd1 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Thu, 12 Oct 2017 10:15:22 +0100 Subject: [PATCH] kubernetes: Add /etc/os-release to host and bind to kubelet image. Adding a `PRETTY_NAME` to this causes it to appear in the node information: $ kubectl --namespace=kube-system get -o wide nodes NAME STATUS ROLES AGE VERSION EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME linuxkit-b6e09efea36e Ready master 29m v1.8.0 LinuxKit Kubernetes Project 4.9.53-linuxkit containerd://1.0.0-beta.1 Previously it would be `Unknown`. A later yaml passed to `moby build` can override this by simply duplicating the path. Signed-off-by: Ian Campbell --- projects/kubernetes/kube.yml | 3 +++ projects/kubernetes/kubernetes/Dockerfile | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/kubernetes/kube.yml b/projects/kubernetes/kube.yml index 8aa5a61d3..3eec672a8 100644 --- a/projects/kubernetes/kube.yml +++ b/projects/kubernetes/kube.yml @@ -42,6 +42,9 @@ files: metadata: yaml - path: /etc/kubernetes symlink: "/var/lib/kubeadm" + - path: /etc/os-release + contents: | + PRETTY_NAME="LinuxKit Kubernetes Project" - path: /usr/libexec/kubernetes/kubelet-plugins symlink: "/var/lib/kubelet-plugins" - path: /etc/kubeadm/kube-system.init/50-network.yaml diff --git a/projects/kubernetes/kubernetes/Dockerfile b/projects/kubernetes/kubernetes/Dockerfile index b2739cec0..622a0278a 100644 --- a/projects/kubernetes/kubernetes/Dockerfile +++ b/projects/kubernetes/kubernetes/Dockerfile @@ -75,4 +75,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:rshared,rbind", "/var:/var:rshared,rbind", "/var/lib/kubeadm:/etc/kubernetes", "/etc/kubelet.sh.conf:/etc/kubelet.sh.conf", "/etc/kubeadm:/etc/kubeadm", "/var/lib/kubelet-plugins:/usr/libexec/kubernetes/kubelet-plugins:rshared,rbind"], "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", "/var/lib/kubelet-plugins"], "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"]}]}}' +LABEL org.mobyproject.config='{"binds": ["/dev:/dev", "/etc/resolv.conf:/etc/resolv.conf", "/etc/os-release:/etc/os-release", "/run:/run:rshared,rbind", "/var:/var:rshared,rbind", "/var/lib/kubeadm:/etc/kubernetes", "/etc/kubelet.sh.conf:/etc/kubelet.sh.conf", "/etc/kubeadm:/etc/kubeadm", "/var/lib/kubelet-plugins:/usr/libexec/kubernetes/kubelet-plugins:rshared,rbind"], "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", "/var/lib/kubelet-plugins"], "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"]}]}}'