我是靠谱客的博主 孝顺中心,最近开发中收集的这篇文章主要介绍k8s搭建v1.18.3高可用集群时添加master节点报错:failure loading certificate for CA: couldn‘t load the certificate fil,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

问题描述:

个人搭建k8s高可用集群时,版本为:v1.18.3
在加入master加点时报错如下:

在这里插入图片描述
kubelet忘记了加入开机自启,自己执行以下就好,主要下面有个failure

[root@master02 ~]# kubeadm join 172.16.46.200:6444 --token abcdef.0123456789abcdef 
>     --discovery-token-ca-cert-hash sha256:241b3255c13d3712b0abf1a5fceec1bcff551008f9c756433a7768223c50bf14 
>     --control-plane
[preflight] Running pre-flight checks
	[WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/
	[WARNING Service-Kubelet]: kubelet service is not enabled, please run 'systemctl enable kubelet.service'
[preflight] Reading configuration from the cluster...
[preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml'
error execution phase preflight: 
One or more conditions for hosting a new control plane instance is not satisfied.

failure loading certificate for CA: couldn't load the certificate file /etc/kubernetes/pki/ca.crt: open /etc/kubernetes/pki/ca.crt: no such file or directory

Please ensure that:
* The cluster has a stable controlPlaneEndpoint address.
* The certificates that must be shared among control plane instances are provided.


To see the stack trace of this error execute with --v=5 or higher

查看报错信息后,原因是没有证书文件,在master01节点复制过来即可

在之前的搭建版本1.15.x版本时没有添加证书的步骤,到了1.18版本需要提前准备master01的证书!

解决方法:

  194  scp -rp /etc/kubernetes/pki/ca.* master02:/etc/kubernetes/pki
  195  scp -rp /etc/kubernetes/pki/sa.* master02:/etc/kubernetes/pki
  196  scp -rp /etc/kubernetes/pki/front-proxy-ca.* master02:/etc/kubernetes/pki
  197  scp -rp /etc/kubernetes/pki/etcd/ca.* master02:/etc/kubernetes/pki/etcd
  198  scp -rp /etc/kubernetes/admin.conf master02:/etc/kubernetes

重新运行命令加入节点,查看集群节点

[root@master02 ~]# kubectl get nodes
NAME       STATUS     ROLES    AGE   VERSION
master01   NotReady   master   24m   v1.18.3
master02   NotReady   master   37s   v1.18.3

最后

以上就是孝顺中心为你收集整理的k8s搭建v1.18.3高可用集群时添加master节点报错:failure loading certificate for CA: couldn‘t load the certificate fil的全部内容,希望文章能够帮你解决k8s搭建v1.18.3高可用集群时添加master节点报错:failure loading certificate for CA: couldn‘t load the certificate fil所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(46)

评论列表共有 0 条评论

立即
投稿
返回
顶部