单纯记录一下自己安装时遇见的问题!!
1.kubeadm初始化报错
初始化主节点时报错:timed out waiting for the condition
kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Starting the kubelet
[kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap...
[kubelet-check] Initial timeout of 40s passed.
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'
timed out waiting for the condition
error execution phase kubelet-start
解决:
血泪史: k8s Initial timeout of 40s passed._花木兰-CSDN博客
cd /etc/systemd/system/kubelet.service.d
vim 10-kubeadm.conf
添加
# Note: This dropin only works with kubeadm and kubelet v1.11+
[Service]
Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf"
Environment="KUBELET_CONFIG_ARGS=--config=/var/lib/kubelet/config.yaml"
# This is a file that "kubeadm init" and "kubeadm join" generates at runtime, populating the KUBELET_KUBEADM_ARGS variable dynamically
EnvironmentFile=-/var/lib/kubelet/kubeadm-flags.env
# This is a file that the user can use for overrides of the kubelet args as a last resort. Preferably, the user should use
# the .NodeRegistration.KubeletExtraArgs object in the configuration files instead. KUBELET_EXTRA_ARGS should be sourced from this file.
EnvironmentFile=-/etc/default/kubelet
ExecStart=
ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS
2.加入工作节点时报错
Failed to request cluster info...connect: no route to host
I1104 10:45:07.457305 16047 token.go:82] [discovery] Failed to request cluster info, will try again: [Get https://192.168.66.10:6443/api/v1/namespaces/kube-public/configmaps/cluster-info: dial tcp 192.168.66.10:6443: connect: no route to host]
解决
systemctl stop kubelet
systemctl stop docker
iptables --flush
iptables -tnat --flush
systemctl start kubelet
systemctl start docker
3.node节点出现
[root@k8s-node02 ~]# kubectl get pod -o wide
The connection to the server localhost:8080 was refused - did you specify the right host or port?
解决:
#将主节点下的/etc/kubernetes/admin.conf拷贝到子节点的相同目录下
4.离线安装harbor-offline-installer-v1.2.0.tgz时莫名报错email from中的"<" unexpected
没有找到解决办法,选择另一个版本安装解决问题
下载 harbor-offline-installer-v1.10.9.tgz版本
解压后修改配置文件
[root@k8s-hub harbor]# vi harbor.yml
采用https,修改为自己对应存储目录
5.克隆虚拟机当作node节点加入时发现该机无法创建容器,一直处于ContainerCreating状态
解决
describe问题pod发现 克隆主机时将导致cni0冲突
[root@k8s-node02 ~]# kubectl describe pod nginx-deployment5-698dd9ff9b-bmrbp
报错如下
执行
[root@k8s-node02 ~]# ifconfig cni0 down [root@k8s-node02 ~]# ip link delete cni0
之后再次重建deployment时cni0会被自动创建问题解决
6.重启docker服务后,发现Harbor无法访问需重新安装
解决
#停掉docker-compose [root@k8s-hub harbor]# docker-compose down #执行harbor下的准备文件./prepare [root@k8s-hub harbor]# ./prepare #设置docker-compose后台运行 [root@k8s-hub harbor]# docker-compose up -d