K8S证书更换
重新生成证书
证书备份
cp -rp /etc/kubernetes /etc/kubernetes.bak
移除过期证书
rm -f /etc/kubernetes/pki/apiserver*rm -f /etc/kubernetes/pki/front-proxy-client.*
rm -rf /etc/kubernetes/pki/etcd/healthcheck-client.*
rm -rf /etc/kubernetes/pki/etcd/server.*
rm -rf /etc/kubernetes/pki/etcd/peer.*
备注:可以使用命令
openssl x509 -in [证书全路径] -noout -text
查看证书详情
在当前路径下新建config.yaml
kind: MasterConfigurationapiVersion: kubeadm.k8s.io/v1alpha1
kubernetesVersion: v1.11.0
api:
advertiseAddress: 10.0.8.68(主节点机器IP)
然后执行
kubeadm alpha phase certs all --config config.yaml
重新生成配置文件
mv /etc/kubernetes/mv /etc/kubernetes/*.conf /tmp/
kubeadm alpha phase kubeconfig all --config config.yaml
重启kubelet
systemctl restart kubelet
证书过期时间确认
openssl x509 -in /etc/kubernetes/pki/apiserver.crt -noout -text |grep " Not "其他同理
集群确认
#覆盖配置文件cp -rfp /etc/kubernetes/admin.conf ~/.kube/config
kubectl get no
以上是 K8S证书更换 的全部内容, 来源链接: utcz.com/z/510792.html