赞
踩
The connection to the server 192.168.5.130:6443 was refused - did you specify the right host or port?
K8S集群启动报错 kubelet cgroup driver: “cgroupfs” is different from docker cgroup driver: “systemd”
master节点初始化的时候,docker配置如下,忘了设置cgroup driver: “systemd
vim /etc/docker/daemon.json
{
"exec-opts": ["native.cgroupdriver=cgroupfs"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"storage-driver": "overlay2",
"storage-opts": [
"overlay2.override_kernel_check=true"
],
"registry-mirrors": ["https://pf5f57i3.mirror.aliyuncs.com"]
}
k8s 主节点安装k8s,有错误提示但是启动了,其他主节点和node节点加入也正常,看到整个集群都Ready,回去在修改主节点的 /etc/docker/daemon.json,native.cgroupdriver=systemd,改完重启kubelet后,发现3个主节点都起不来了。
journalctl -f -u kubelet 查看日志发现,报错如下:
kubelet cgroup driver: “cgroupfs” is different from docker cgroup driver: “systemd”
这个里要修改3个配置文件为systemd
1.vim /etc/docker/daemon.json
“exec-opts”: [“native.cgroupdriver=systemd”]
2.vim /usr/lib/systemd/system/kubelet.service.d/10-kubeadm.conf
在KUBELET_KUBECONFIG_ARGS 后面追加 --cgroup-driver=systemd
Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf --cgroup-driver=systemd"
3.vim /var/lib/kubelet/kubeadm-flags.env
KUBELET_KUBEADM_ARGS="--cgroup-driver=systemd --network-plugin=cni --pod-infra-container-image=registry.aliyuncs.com/google_containers/pause:3.2"
systemctl daemon-reload
systemctl restart kubelet
然后重启kubelet,k8s集群就恢复了。
猜测造成这个问题的原因,一开始安装docker时没有指定 /etc/docker/daemon.json
“exec-opts”: [“native.cgroupdriver=systemd”]造成的!!!
登录harbor并推送给harbor docker仓库镜像
"exec-opts": ["native.cgroupdriver=systemd"],
"insecure-registries": ["192.168.5.130","192.168.5.131","192.168.5.133"]
需要在 /etc/docker/daemon.json添加这个docker才能互相登录!
Harbor登录时提示 “核心功能无法使用”
重启:
1、定位到harbor的位置,如/var/www/harbor
2、停止命令
docker-compose stop
3、启动命令
docker-compose up -d
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。