安装Kubernetes报错:The kubelet is not running

执行 sudo kubeadm init --config kubeadm.conf 的过程中抛出下面的错误:

Unfortunately, an error has occurred:
    timed out waiting for the condition

This error is likely caused by:
    - The kubelet is not running
    - The kubelet is unhealthy due to a misconfiguration of the node in some way (required cgroups disabled)

If you are on a systemd-powered system, you can try to troubleshoot the error with the following commands:
    - 'systemctl status kubelet'
    - 'journalctl -xeu kubelet'

原因是:基础镜像pause的拉取地址需要单独设置,否则还是会从k8s.gcr.io来拉取,导致init的时候卡住,并最终失败。

解决方案有2种:

  1. 打一个k8s.gcr.io/pause:3.1的Tag
docker tag registry.aliyuncs.com/google_containers/pause:3.1 k8s.gcr.io/pause:3.1
  1. 修改kubeadm.conf
    可以通过修改kubeadm.conf中的InitConfiguration的nodeRegistration:kubeletExtraArgs:pod-infra-container-image参数来设置基础镜像,大约在14行,修改后如下:
kind: InitConfiguration
nodeRegistration:
  kubeletExtraArgs:
    pod-infra-container-image: registry.cn-beijing.aliyuncs.com/imcto/pause:3.1

你可能感兴趣的:(安装Kubernetes报错:The kubelet is not running)