Skip to content

Latest commit

 

History

History
24 lines (18 loc) · 1.39 KB

解决K8S-Token过期的问题.md

File metadata and controls

24 lines (18 loc) · 1.39 KB

由于我是用kubeadm搭建的K8s集群, kubeadm创建的Token的默认有效期为24小时, 因此24小时后会失效

一、查看 token 剩余时间

[root@k8s-master ~]# kubeadm token list
TOKEN                     TTL         EXPIRES                     USAGES                   DESCRIPTION                                                EXTRA GROUPS
sz2gnl.8njr74u8iq2wdno7   23h         2020-11-10T11:30:05+08:00   authentication,signing   The default bootstrap token generated by 'kubeadm init'.   system:bootstrappers:kubeadm:default-node-token

二、创建永久token

[root@k8s-master ~]# kubeadm token create --ttl 0
[root@k8s-master ~]# kubeadm token list
TOKEN                     TTL         EXPIRES   USAGES                   DESCRIPTION                                                EXTRA GROUPS
6ezoom.pkad8xwq7njlyn5i   <forever>   <never>   authentication,signing   <none>                                                     system:bootstrappers:kubeadm:default-node-token
sz2gnl.8njr74u8iq2wdno7   23h         2020-11-10T11:30:05+08:00   authentication,signing   The default bootstrap token generated by 'kubeadm init'.   system:bootstrappers:kubeadm:default-node-token