k8s节点状态Init:0/1

k8s节点状态Init:0/1

在节点机器上打印日志:

journalctl -f -u kubelet

出现以下内容:

5月 29 15:27:34 k8snode2 kubelet[2249]: For verbose messaging see aws.Config.CredentialsChainVerboseErrors
5月 29 15:27:34 k8snode2 kubelet[2249]: E0529 15:27:34.623978 2249 remote_runtime.go:105] RunPodSandbox from runtime service failed: rpc error: code = Unknown desc = failed pulling image "registry.aliyuncs.com/google_containers/pause:3.2": Error response from daemon: Get https://registry.aliyuncs.com/v2/: dial tcp: lookup registry.aliyuncs.com on [::1]:53: read udp [::1]:33513->[::1]:53: read: connection refused
5月 29 15:27:34 k8snode2 kubelet[2249]: E0529 15:27:34.624037 2249 kuberuntime_sandbox.go:68] CreatePodSandbox for pod "kube-proxy-6r7gb_kube-system(0c37d7c5-694c-4952-a3c9-e468f4a37cfe)" failed: rpc error: code = Unknown desc = failed pulling image "registry.aliyuncs.com/google_containers/pause:3.2": Error response from daemon: Get https://registry.aliyuncs.com/v2/: dial tcp: lookup registry.aliyuncs.com on [::1]:53: read udp [::1]:33513->[::1]:53: read: connection refused
5月 29 15:27:34 k8snode2 kubelet[2249]: E0529 15:27:34.624054 2249 kuberuntime_manager.go:727] createPodSandbox for pod "kube-proxy-6r7gb_kube-system(0c37d7c5-694c-4952-a3c9-e468f4a37cfe)" failed: rpc error: code = Unknown desc = failed pulling image "registry.aliyuncs.com/google_containers/pause:3.2": Error response from daemon: Get https://registry.aliyuncs.com/v2/: dial tcp: lookup registry.aliyuncs.com on [::1]:53: read udp [::1]:33513->[::1]:53: read: connection refused
5月 29 15:27:34 k8snode2 kubelet[2249]: E0529 15:27:34.624097 2249 pod_workers.go:191] Error syncing pod 0c37d7c5-694c-4952-a3c9-e468f4a37cfe ("kube-proxy-6r7gb_kube-system(0c37d7c5-694c-4952-a3c9-e468f4a37cfe)"), skipping: failed to "CreatePodSandbox" for "kube-proxy-6r7gb_kube-system(0c37d7c5-694c-4952-a3c9-e468f4a37cfe)" with CreatePodSandboxError: "CreatePodSandbox for pod "kube-proxy-6r7gb_kube-system(0c37d7c5-694c-4952-a3c9-e468f4a37cfe)" failed: rpc error: code = Unknown desc = failed pulling image "registry.aliyuncs.com/google_containers/pause:3.2": Error response from daemon: Get https://registry.aliyuncs.com/v2/: dial tcp: lookup registry.aliyuncs.com on [::1]:53: read udp [::1]:33513->[::1]:53: read: connection refused"
5月 29 15:27:35 k8snode2 kubelet[2249]: W0529 15:27:35.831411 2249 cni.go:237] Unable to update cni config: no networks found in /etc/cni/net.d

解决方法:修改resolv.conf中的DNS

打开:

vi /etc/resolv.conf

添加一行:

nameserver 223.5.5.5

保存。

K8S安装过程,可参考:https://www.cnblogs.com/xiaokantianse/p/14184303.html 。

原文地址:https://www.cnblogs.com/runliuv/p/14825514.html