3

我可以将 kubelet 作为基于 kubernetes v1.6.6 的 docker 容器运行吗?如果可以,如何创建图像或从哪里获取图像,以及如何运行该图像?

以下是我的操作,但有一些问题。

Dockerfile FROM i71:5000/ubuntu:14.04 ADD iptables /usr/local/bin/iptables ADD bin/kubelet /usr/local/bin/kubelet

码头工人运行 sh #!/bin/bash docker rm -f $(docker ps -aq --filter "name=kubelet") docker run \ -d \ --restart="always" \ --net="host" \ -v /data/kubernetes-cluster/ssl:/data/kubernetes-cluster/ssl \ -v /data/kubernetes-cluster/kube-conf:/data/kubernetes-cluster/kube-conf \ -v /data/kubernetes-cluster/log:/data/kubernetes-cluster/log \ -v /data/kubelet:/var/lib/kubelet \ -v /etc/localtime:/etc/localtime \ -v /var/run/:/var/run/ \ -v /var/log/:/var/log/ \ --privileged=true \ --name kubelet \ i71:5000/kubelet:v1.6.6 \ /usr/local/bin/kubelet \ --logtostderr=true \ --v=0 \ --cgroup-driver=cgroupfs \ --api-servers=http://192.168.0.97:8080 \ --docker-endpoint=http://127.0.0.1:4243 \ --address=192.168.0.97 \ --hostname-override=192.168.0.97 \ --allow-privileged=true \ --pod-infra-container-image=i71:5000/pod-infrastructure:rhel7 \ --cluster-dns=10.3.0.2 \ --experimental-bootstrap-kubeconfig=/data/kubernetes-cluster/kube-conf/bootstrap.kubeconfig \ --kubeconfig=/data/kubernetes-cluster/kube-conf/kubelet.kubeconfig \ --require-kubeconfig \ --cert-dir=/data/kubernetes-cluster/ssl \ --cluster-domain=cluster.local. \ --hairpin-mode=promiscuous-bridge \ --serialize-image-pulls=false

kubelet 打印出这些错误(我的 docker damon pid 是 5140): E0706 12:11:46.061949 1 container_manager_linux.go:394] open /proc/5140/cgroup: no such file or directory E0706 12:11:46.137217 1 container_manager_linux.go:97] Unable to ensure the docker processes run in the desired containers E0706 12:16:46.062290 1 container_manager_linux.go:394] open /proc/5140/cgroup: no such file or directory E0706 12:16:46.138189 1 container_manager_linux.go:97] Unable to ensure the docker processes run in the desired containers

如果我执行卷主机目录“/proc”,则 docker damon 发生错误。 docker: Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused "process_linux.go:359: container init caused \"rootfs_linux.go:54: mounting\\\"/proc\\\" to rootfs \\\"/data/docker/local-storage/docker/aufs/mnt/6ad53fff3b30e8d709b1be326f5de1314371e174e34806d4d6c6436275b6fbd3\\\" at \\\"/proc\\\" caused \\\"\\\\\\\"/data/docker/local-storage/docker/aufs/mnt/6ad53fff3b30e8d709b1be326f5de1314371e174e34806d4d6c6436275b6fbd3/proc\\\\\\\" cannot be mounted because it is located inside \\\\\\\"/proc\\\\\\\"\\\"\"".

我该怎么办,谁能给我点灯?

4

1 回答 1

1

有一个名为的官方 docker 映像hyperkube,其中包含所有 Kubernetes 二进制文件,请参阅https://kubernetes.io/docs/getting-started-guides/scratch/#selecting-images

您可以在此处找到有关如何使用它的示例 systemd 服务kubelethttps ://github.com/kubernetes/kubernetes-anywhere/blob/master/phase2/ignition/vanilla/kubelet.service

于 2017-07-06T10:03:30.077 回答