无法在Kubernetes master中看到连接节点

时间:2018-04-13 10:39:33

标签: kubernetes kubectl kubeadm

这是我的工作节点:

root@ivu:~# kubeadm join 10.16.70.174:6443 --token hl36mu.0uptj0rp3x1lfw6n --discovery-token-ca-cert-hash sha256:daac28160d160f938b82b8c720cfc91dd9e6988d743306f3aecb42e4fb114f19 --ignore-preflight-errors=swap
[preflight] Running pre-flight checks.
        [WARNING Swap]: running with swap on is not supported. Please disable swap
        [WARNING FileExisting-crictl]: crictl not found in system path
Suggestion: go get github.com/kubernetes-incubator/cri-tools/cmd/crictl
[discovery] Trying to connect to API Server "10.16.70.174:6443"
[discovery] Created cluster-info discovery client, requesting info from "https://10.16.70.174:6443"
[discovery] Requesting info from "https://10.16.70.174:6443" again to validate TLS against the pinned public key
[discovery] Cluster info signature and contents are valid and TLS certificate validates against pinned roots, will use API Server "10.16.70.174:6443"
[discovery] Successfully established connection with API Server "10.16.70.174:6443"

This node has joined the cluster:
* Certificate signing request was sent to master and a response
  was received.
* The Kubelet was informed of the new secure connection details.

Run 'kubectl get nodes' on the master to see this node join the cluster.

使用命令kubectl get nodes检入主节点时,我只能看到master:

ivum01@ivum01-HP-Pro-3330-SFF:~$ kubectl get nodes
NAME                     STATUS    ROLES     AGE       VERSION
ivum01-hp-pro-3330-sff   Ready     master    36m       v1.10.0

问答:

  1. docker kubelet kubeadm kubectl安装得很好
  2. kubectl get node无法看到当前添加的节点;原因kubectl get pods --all-namespaces对此节点没有结果;
  3. docker当前节点中没有kubeadm命令的报告(表示没有k8s图像拉,没有正在运行的容器)
  4. 必须导入kubelet未在工作节点
  5. 中运行
  6. 运行kubelet输出:

      

    无法获取" /user.slice/user-1000.slice/session-1.scope"的系统容器统计信息:未能获得" /user.slice/user的cgroup统计信息-1000.slice / session-1.scope":未能获得" /user.slice/user-1000.slice/session-1.scope"的容器信息:未知容器" /user.slice/user-1000.slice/session-1.scope"

    this issue said

  7. 相同
  8. 拆除并重置群集(kubeadm reset)并重做我的情况没有问题。

1 个答案:

答案 0 :(得分:0)

我遇到了这个问题,它通过确保 worker 节点上的cgroup驱动程序也设置正确来解决。

检查:

docker info | grep -i cgroup
cat /etc/systemd/system/kubelet.service.d/10-kubeadm.conf

将其设置为:

sed -i "s/cgroup-driver=systemd/cgroup-driver=cgroupfs/g" /etc/systemd/system/kubelet.service.d/10-kubeadm.conf

然后重新启动kubelet服务并重新加入群集:

systemctl daemon-reload
systemctl restart kubelet
kubeadm reset
kubeadm join ...

来自文档的信息:https://kubernetes.io/docs/tasks/tools/install-kubeadm/#configure-cgroup-driver-used-by-kubelet-on-master-node