用kubedam搭建的k8s证书过期处理方法

kubeadm部署的k8s证书过期
1、查看证书过期时间
kubeadm alpha certs  check-expiration
若证书已经过期无法试用kubectl命令建议修改服务器时间到未过期的时间段
2、配置kube-controller-manager.yaml文件
cat /etc/kubernetes/manifests/kube-controller-manager.yaml
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
component: kube-controller-manager
tier: control-plane
name: kube-controller-manager
namespace: kube-system
spec:
containers:
- command:
- kube-controller-manager
- --experimental-cluster-signing-duration=87600h0m0s #增加证书颁发时间参数
- --feature-gates=RotateKubeletServerCertificate=true #开启server证书签发
- --allocate-node-cidrs=true

3、重新生成新的证书
kubeadm alpha certs renew
4、重启apiserver和controller-managerpod
kubectl delete pod  -n kube-system   kube-apiserver-k8s-master 
kubectl delete pod  -n kube-system   kube-controller-manager-k8s-master 

你可能感兴趣的:(k8s,1024程序员节)