【K8S搭载高可用集群报错】error downloading certs: error decoding certificate key: encoding/hex: invalid byte: U

4 篇文章 0 订阅
3 篇文章 0 订阅

master1已经搭建并且输出了token

[root@master1 ~]# kubeadm token create --print-join-command --certificate-key --v=5
kubeadm join 10.10.19.141:8443 --token hw9fe4.s0jhfpcqqx38swwb --discovery-token-ca-cert-hash sha256:e9df4c818e0e3d291b18529e80fcfbd3fb2651879c0985db2e97a235b5c04f64 --control-plane --certificate-key --v=5

master2加入时指定socket,在后面加入–cri-socket unix:///run/containerd/containerd.sock,如果以docker为容器加上–cri-socket unix:///var/run/cri-dockerd.sock
发现报错了!!!
master2加入时报错error execution phase control-plane-prepare/download-certs: error downloading certs: error decoding certificate key: encoding/hex: invalid byte: U+002D ‘-’

[root@master2 ~]# kubeadm join 10.10.19.141:8443 --token hw9fe4.s0jhfpcqqx38swwb --discovery-token-ca-cert-hash sha256:e9df4c818e0e3d291b18529e80fcfbd3fb2651879c0985db2e97a235b5c04f64 --control-plane --certificate-key --v=5 --cri-socket unix:///run/containerd/containerd.sock
[preflight] Running pre-flight checks
[preflight] Reading configuration from the cluster...
[preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'
[preflight] Running pre-flight checks before initializing the new control plane instance
[preflight] Pulling images required for setting up a Kubernetes cluster
[preflight] This might take a minute or two, depending on the speed of your internet connection
[preflight] You can also perform this action in beforehand using 'kubeadm config images pull'
[download-certs] Downloading the certificates in Secret "kubeadm-certs" in the "kube-system" Namespace
error execution phase control-plane-prepare/download-certs: error downloading certs: error decoding certificate key: encoding/hex: invalid byte: U+002D '-'
To see the stack trace of this error execute with --v=5 or higher

在master1上重新生成证书密钥

[root@master1 ~]# kubeadm init phase upload-certs --upload-certs --config kubeadm-init.yaml
[upload-certs] Storing the certificates in Secret "kubeadm-certs" in the "kube-system" Namespace
[upload-certs] Using certificate key:
b80e18d761b1614f8ee53b1d1018aa09bd54efb37efb7391013b76ef3e4f04cb

master2加入时加上证书密钥字段 --certificate-key b80e18d761b1614f8ee53b1d1018aa09bd54efb37efb7391013b76ef3e4f04cb

[root@master2 containerd]# kubeadm join 10.10.19.141:8443 --token t45zd2.f9njrzf3dn9w0j9y --discovery-token-ca-cert-hash sha256:e9df4c818e0e3d291b18529e80fcfbd3fb2651879c0985db2e97a235b5c04f64 --control-plane  --v=5 --cri-socket unix:///run/containerd/containerd.sock  --certificate-key b80e18d761b1614f8ee53b1d1018aa09bd54efb37efb7391013b76ef3e4f04cb

在这里插入图片描述
成功!
其他补充:
node加入集群的命令

[root@node1 ~]# kubeadm join 10.10.19.141:8443 --token t45zd2.f9njrzf3dn9w0j9y --discovery-token-ca-cert-hash sha256:e9df4c818e0e3d291b18529e80fcfbd3fb2651879c0985db2e97a235b5c04f64  --v=5 --cri-socket unix:///run/containerd/containerd.sock 

解释一下每个字段的含义

字段含义
–discovery-token-ca-cert-hash验证新节点的哈希值
–control-plane此节点为控制节点
–v=5记录所有的日志信息,包括调试信息
–cri-socketsocket文件位置
–certificate-key证书密钥
  • 9
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

久呀

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值