kubeadm alpha certs check-expiration kubernetes证书过期时间
/etc/kubernetes/pki/apiserver.crt #1年有效期
/etc/kubernetes/pki/front-proxy-ca.crt #10年有效期
/etc/kubernetes/pki/ca.crt #10年有效期
/etc/kubernetes/pki/apiserver-etcd-client.crt #1年有效期
/etc/kubernetes/pki/front-proxy-client.crt #1年有效期
/etc/kubernetes/pki/etcd/server.crt #1年有效期
/etc/kubernetes/pki/etcd/ca.crt #10年有效期
/etc/kubernetes/pki/etcd/peer.crt #1年有效期
/etc/kubernetes/pki/etcd/healthcheck-client.crt #1年有效期
/etc/kubernetes/pki/apiserver-kubelet-client.crt #1年有效期
kubeadm config view > /tools/cluster.yaml
cp -rp /etc/kubernetes /tools/kubernetes.bak
cp -r /var/lib/etcd /tools/etcd.bak
kubeadm alpha certs renew all –config=/tools/cluster.yaml
docker ps |grep -E ‘k8s_kube-apiserver|k8s_kube-controller-manager|k8s_kube-scheduler|k8s_etcd_etcd’ | awk -F ‘ ‘ ‘{print $1}’|xargs docker restart
for item in find /etc/kubernetes/pki -maxdepth 2 -name “*.crt”;do openssl x509 -in $item -text -noout| grep Not;
echo ======================$item===============;done
kubectl edit users admin
kubectl get users admin
kubectl patch users admin -p ‘{“spec”:{“password”:“P@88w0rd”}}’ –type=‘merge’ && kubectl annotate users admin iam.kubesphere.io/password-encrypted-
覆盖本地kubeconf:
cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
base64加密:
cat $HOME/.kube/config |base64
得到加密好的文字,使用sublime去掉换行符,得到最终的秘钥
更新HOST集群中的cluster配置
kubect edit cluster XXXX
替换掉
spec:
connection:
kubeconfig: