状态NotReady中的Kubernetes工作节点

时间:2018-05-01 11:36:41

标签: kubernetes

我一直在尝试在一组Raspberry Pi上设置K8s群集。这是我的GitHub页面的链接,它描述了整个设置:

https://github.com/joesan/plant-infra/blob/master/pi/README.md

我现在已经陷入了与主人加入我的工作节点的最后一步。我确实在工作节点上发出了join命令,但之后我检查了master中的节点,我看到了以下内容:

pi@k8s-master-01:~ $ kubectl get nodes
NAME            STATUS     ROLES     AGE       VERSION
k8s-master-01   Ready      master    56m       v1.9.6
k8s-worker-01   NotReady   <none>    26m       v1.9.6
k8s-worker-02   NotReady   <none>    6m        v1.9.6

问题是,我是否还需要在工作节点上安装像编织一样的容器网络?

以下是来自工作节点的日志文件:

pi@k8s-worker-02:~ $ journalctl -u kubelet
-- Logs begin at Thu 2016-11-03 17:16:42 UTC, end at Tue 2018-05-01 11:35:54 UTC. --
May 01 11:27:28 k8s-worker-02 systemd[1]: Started kubelet: The Kubernetes Node Agent.
May 01 11:27:30 k8s-worker-02 kubelet[334]: I0501 11:27:30.995549     334 feature_gate.go:226] feature gates: &{{} map[]}
May 01 11:27:31 k8s-worker-02 kubelet[334]: I0501 11:27:31.005491     334 controller.go:114] kubelet config controller: starting controller
May 01 11:27:31 k8s-worker-02 kubelet[334]: I0501 11:27:31.005584     334 controller.go:118] kubelet config controller: validating combination of defaults and flags
May 01 11:27:31 k8s-worker-02 kubelet[334]: W0501 11:27:31.052134     334 cni.go:171] Unable to update cni config: No networks found in /etc/cni/net.d
May 01 11:27:31 k8s-worker-02 kubelet[334]: I0501 11:27:31.084480     334 server.go:182] Version: v1.9.6
May 01 11:27:31 k8s-worker-02 kubelet[334]: I0501 11:27:31.085670     334 feature_gate.go:226] feature gates: &{{} map[]}
May 01 11:27:31 k8s-worker-02 kubelet[334]: I0501 11:27:31.092807     334 plugins.go:101] No cloud provider specified.
May 01 11:27:31 k8s-worker-02 kubelet[334]: I0501 11:27:31.110132     334 certificate_store.go:130] Loading cert/key pair from ("/var/lib/kubelet/pki/kubelet-client.crt", "/var/lib/
May 01 11:27:39 k8s-worker-02 kubelet[334]: E0501 11:27:39.905417     334 machine.go:194] failed to get cache information for node 0: open /sys/devices/system/cpu/cpu0/cache: no suc
May 01 11:27:39 k8s-worker-02 kubelet[334]: I0501 11:27:39.911993     334 server.go:428] --cgroups-per-qos enabled, but --cgroup-root was not specified.  defaulting to /
May 01 11:27:39 k8s-worker-02 kubelet[334]: I0501 11:27:39.914203     334 container_manager_linux.go:242] container manager verified user specified cgroup-root exists: /
May 01 11:27:39 k8s-worker-02 kubelet[334]: I0501 11:27:39.914272     334 container_manager_linux.go:247] Creating Container Manager object based on Node Config: {RuntimeCgroupsName
May 01 11:27:39 k8s-worker-02 kubelet[334]: I0501 11:27:39.914895     334 container_manager_linux.go:266] Creating device plugin manager: false
May 01 11:27:39 k8s-worker-02 kubelet[334]: I0501 11:27:39.919031     334 kubelet.go:291] Adding manifest path: /etc/kubernetes/manifests
May 01 11:27:39 k8s-worker-02 kubelet[334]: I0501 11:27:39.919197     334 kubelet.go:316] Watching apiserver
May 01 11:27:39 k8s-worker-02 kubelet[334]: E0501 11:27:39.935754     334 reflector.go:205] k8s.io/kubernetes/pkg/kubelet/config/apiserver.go:47: Failed to list *v1.Pod: Get https:/
May 01 11:27:39 k8s-worker-02 kubelet[334]: E0501 11:27:39.937449     334 reflector.go:205] k8s.io/kubernetes/pkg/kubelet/kubelet.go:480: Failed to list *v1.Node: Get https://192.16
May 01 11:27:39 k8s-worker-02 kubelet[334]: E0501 11:27:39.937492     334 reflector.go:205] k8s.io/kubernetes/pkg/kubelet/kubelet.go:471: Failed to list *v1.Service: Get https://192
May 01 11:27:39 k8s-worker-02 kubelet[334]: W0501 11:27:39.948764     334 kubelet_network.go:139] Hairpin mode set to "promiscuous-bridge" but kubenet is not enabled, falling back t
May 01 11:27:39 k8s-worker-02 kubelet[334]: I0501 11:27:39.949871     334 kubelet.go:577] Hairpin mode set to "hairpin-veth"
May 01 11:27:39 k8s-worker-02 kubelet[334]: W0501 11:27:39.951008     334 cni.go:171] Unable to update cni config: No networks found in /etc/cni/net.d
May 01 11:27:39 k8s-worker-02 kubelet[334]: I0501 11:27:39.952122     334 client.go:80] Connecting to docker on unix:///var/run/docker.sock
May 01 11:27:39 k8s-worker-02 kubelet[334]: I0501 11:27:39.952976     334 client.go:109] Start docker client with request timeout=2m0s
May 01 11:27:39 k8s-worker-02 kubelet[334]: W0501 11:27:39.959045     334 cni.go:171] Unable to update cni config: No networks found in /etc/cni/net.d
May 01 11:27:39 k8s-worker-02 kubelet[334]: W0501 11:27:39.971616     334 cni.go:171] Unable to update cni config: No networks found in /etc/cni/net.d
May 01 11:27:39 k8s-worker-02 kubelet[334]: I0501 11:27:39.971765     334 docker_service.go:232] Docker cri networking managed by cni
May 01 11:27:40 k8s-worker-02 kubelet[334]: I0501 11:27:40.002411     334 docker_service.go:237] Docker Info: &{ID:25GN:65LU:UXAR:CUUY:DOQH:ST4A:IQOE:PIDR:BKYC:UVJH:LI5H:HQSG Contai
May 01 11:27:40 k8s-worker-02 kubelet[334]: I0501 11:27:40.002766     334 docker_service.go:250] Setting cgroupDriver to cgroupfs
May 01 11:27:40 k8s-worker-02 kubelet[334]: I0501 11:27:40.058142     334 remote_runtime.go:43] Connecting to runtime service unix:///var/run/dockershim.sock
May 01 11:27:40 k8s-worker-02 kubelet[334]: I0501 11:27:40.098202     334 kuberuntime_manager.go:186] Container runtime docker initialized, version: 18.04.0-ce, apiVersion: 1.37.0
May 01 11:27:40 k8s-worker-02 kubelet[334]: I0501 11:27:40.110512     334 server.go:755] Started kubelet
May 01 11:27:40 k8s-worker-02 kubelet[334]: I0501 11:27:40.112242     334 kubelet_node_status.go:273] Setting node annotation to enable volume controller attach/detach
May 01 11:27:40 k8s-worker-02 kubelet[334]: I0501 11:27:40.114014     334 server.go:129] Starting to listen on 0.0.0.0:10250
May 01 11:27:40 k8s-worker-02 kubelet[334]: E0501 11:27:40.114962     334 kubelet.go:1281] Image garbage collection failed once. Stats initialization may not have completed yet: fai
May 01 11:27:40 k8s-worker-02 kubelet[334]: I0501 11:27:40.133665     334 server.go:299] Adding debug handlers to kubelet server.
May 01 11:27:40 k8s-worker-02 kubelet[334]: E0501 11:27:40.141790     334 event.go:209] Unable to write event: 'Post https://192.168.0.101:6443/api/v1/namespaces/default/events: dia
May 01 11:27:40 k8s-worker-02 kubelet[334]: E0501 11:27:40.175654     334 container_manager_linux.go:583] [ContainerManager]: Fail to get rootfs information unable to find data for
May 01 11:27:40 k8s-worker-02 kubelet[334]: I0501 11:27:40.175765     334 fs_resource_analyzer.go:66] Starting FS ResourceAnalyzer
May 01 11:27:40 k8s-worker-02 kubelet[334]: I0501 11:27:40.176241     334 volume_manager.go:247] Starting Kubelet Volume Manager
lines 1-41

为什么我的工作节点显示为NotReady?

编辑:我使用kubectl describe nodes命令跟踪错误:

Name:               k8s-worker-02
Roles:              <none>
Labels:             beta.kubernetes.io/arch=arm
                    beta.kubernetes.io/os=linux
                    kubernetes.io/hostname=k8s-worker-02
Annotations:        node.alpha.kubernetes.io/ttl=0
                    volumes.kubernetes.io/controller-managed-attach-detach=true
Taints:             <none>
CreationTimestamp:  Tue, 01 May 2018 11:26:50 +0000
Conditions:
  Type             Status  LastHeartbeatTime                 LastTransitionTime                Reason                       Message
  ----             ------  -----------------                 ------------------                ------                       -------
  OutOfDisk        False   Tue, 01 May 2018 11:40:17 +0000   Tue, 01 May 2018 11:26:43 +0000   KubeletHasSufficientDisk     kubelet has sufficient disk space available
  MemoryPressure   False   Tue, 01 May 2018 11:40:17 +0000   Tue, 01 May 2018 11:26:43 +0000   KubeletHasSufficientMemory   kubelet has sufficient memory available
  DiskPressure     False   Tue, 01 May 2018 11:40:17 +0000   Tue, 01 May 2018 11:26:43 +0000   KubeletHasNoDiskPressure     kubelet has no disk pressure
  Ready            False   Tue, 01 May 2018 11:40:17 +0000   Tue, 01 May 2018 11:26:43 +0000   KubeletNotReady              runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized. WARNING: CPU hardcapping unsupported

我该如何解决这个问题?

5 个答案:

答案 0 :(得分:1)

我遇到了同样的问题,就像在标准的完全正常的设备上安装时一样,我也像死了之吻,所以直到我将工作节点重新加入主节点之后,任何地方的项目都无济于事

我的安装在三台物理计算机上。一位主人和两名工人。所有需要的重新启动。

我没想到它会起作用,但确实可以。可能对您不起作用,但如果没有其他效果,请尝试一下。您将需要您可能没有的加入令牌,但我将向您展示如何获取它,这样您就不必转到另一组页面并进行搜索:

sudo kubeadm token list

复制TOKEN字段数据,输出看起来像这样(不,那不是我的真实姓名):

代币 ow3v08ddddgmgzfkdkdkd7 18h 2018-07-30T12:39:53-05:00身份验证,签名由'kubeadm init'生成的默认引导令牌。系统:引导程序:kubeadm:默认节点令牌

在此加入集群。主节点IP是您计算机的真实IP地址:

sudo kubeadm join --token <YOUR TOKEN HASH> <MASTER_NODE_IP>:6443 --discovery-token-unsafe-skip-ca-verification

答案 1 :(得分:1)

  1. 转到主节点中的主节点,转到/etc/cni/net.d
  2. 在该文件夹中,您将找到一个cni配置文件
  3. 复制该文件并将同一文件上传到您的工作节点的/etc/cni/net.d中
  4. 您的工作节点将在1-2分钟内准备就绪
  5. 如果这不起作用,请添加评论

答案 2 :(得分:0)

我设法解决了这个问题!我就这样做了:

Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'version' in value "${version}"

之后我只评论了包含KUBELET_NETWORK_ARGS

的行

之后我刚刚重新启动系统,我可以看到节点处于就绪状态!

答案 3 :(得分:0)

您也可以安装法兰绒CNI插件,如下所示

git clone https://github.com/containernetworking/cni
cd cni 
git checkout v0.5.2
./build.sh
cp bin/* /opt/cni/bin
mkdir -p /etc/cni/net.d

下载kube-flannel.yml和kube-flannel-rbac.yml from here

然后尝试此操作,您的节点应该就绪

kubectl apply -f kube-flannel.yml -f kube-flannel-rbac.yml

答案 4 :(得分:0)

您需要尝试以下解决方案,看看其中任何一个是否有用

  1. 检查你的火警状态。如果是跑步停止它。
  2. 检查您的Kube-dns状态。有时可能会出现故障或丢失一些错误
  3. 尝试重新加载并重新启动您的Kubelet