当前位置: 首页 > news >正文

响应式网站设计制作免费做网站怎么做网站

响应式网站设计制作,免费做网站怎么做网站,免费设计房子的软件,建筑木模板报价清单一、k8s集群证书过期解决 问题现象 K8S集群证书过期后,会导无法创建Pod,通过kubectl get nodes也无法获取信息,甚至dashboard也无法访问。 执行命令发现报错: Unable to connect to the server: x509: certificate has expire…

一、k8s集群证书过期解决

问题现象

K8S集群证书过期后,会导无法创建Pod,通过kubectl get nodes也无法获取信息,甚至dashboard也无法访问。

执行命令发现报错:

Unable to connect to the server: x509: certificate has expired or is not yet valid

查看K8S的日志:

Part of the existing bootstrap client certificate is expired: 2023-08-29 02:29:04 +0000 UT
这是说明k8s使用的证书过期了,k8s自带证书是一年的有效期。所以我们解决问题的办法就是更换证书。

二、确认K8S证书过期时间

2.1 查看k8s某一证书过期时间:
[root@k8s-master-47 ~]# openssl x509 -in /etc/kubernetes/pki/apiserver.crt -noout -text | grep NotNot Before: Aug 29 03:32:16 2021 GMTNot After : Aug 26 03:32:16 2023 GMT
2.2 其它证书同理,K8s各个证书过期时间如下:
/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年有效期
2.3 或使用统一命令查看
[root@k8s-master-47 ~]# kubeadm alpha certs check-expiration

三、使用延长证书过期的方法解决K8S证书过期问题

K8S在过期之前,使用kubeadm alpha phase里的certs和kubeconfig命令,同时配合kubelet证书自动轮换机制来解决这个问题(具体操作可以百度搜索),这里介绍证书已经过期的解决方法,以下延长证书过期的方法适合kubernetes1.14、1.15、1.16、1.17、1.18版本。操作步骤如下:

3.1 下载update-kubeadm-cert.sh

giuhub地址:

  • https://github.com/yuyicai/update-kube-cert

脚本地址:

  • https://github.com/yuyicai/update-kube-cert/blob/master/update-kubeadm-cert.sh

如果你用containerd 作为 CRI runtime

  • 需要下载update-kubeadm-cert-crictl.sh 这个脚本
3.2 把update-kubeadm-cert.sh文件上传到k8s任一master节点任意位置
3.3 在任一master节点执行如下命令
1)脚本添加可执行权限并执行
chmod +x update-kubeadm-cert.sh
./update-kubeadm-cert.sh all
2)验证
[root@k8s-master-47 ~]# openssl x509 -in /etc/kubernetes/pki/apiserver.crt -noout -text  | grep NotNot Before: Aug 29 03:32:16 2023 GMTNot After : Aug 26 03:32:16 2033 GMT[root@k8s-master-47 ~]# kubeadm alpha certs check-expiration
[check-expiration] Reading configuration from the cluster...
[check-expiration] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml'CERTIFICATE                EXPIRES                  RESIDUAL TIME   CERTIFICATE AUTHORITY   EXTERNALLY MANAGED
admin.conf                 Aug 26, 2033 03:32 UTC   9y                                      no      
apiserver                  Aug 26, 2033 03:32 UTC   9y              ca                      no      
apiserver-etcd-client      Aug 26, 2033 03:32 UTC   9y              etcd-ca                 no      
apiserver-kubelet-client   Aug 26, 2033 03:32 UTC   9y              ca                      no      
controller-manager.conf    Aug 26, 2033 03:32 UTC   9y                                      no      
etcd-healthcheck-client    Aug 26, 2033 03:32 UTC   9y              etcd-ca                 no      
etcd-peer                  Aug 26, 2033 03:32 UTC   9y              etcd-ca                 no      
etcd-server                Aug 26, 2033 03:32 UTC   9y              etcd-ca                 no      
front-proxy-client         Aug 26, 2033 03:32 UTC   9y              front-proxy-ca          no      
scheduler.conf             Aug 26, 2033 03:32 UTC   9y                                      no      CERTIFICATE AUTHORITY   EXPIRES                  RESIDUAL TIME   EXTERNALLY MANAGED
ca                      Aug 24, 2031 11:28 UTC   7y              no      
etcd-ca                 Aug 24, 2031 11:28 UTC   7y              no      
front-proxy-ca          Aug 24, 2031 11:28 UTC   7y              no      
[root@k8s-master-47 ~]# 
3.4 更新证书失败后回滚

The script will back up the /etc/kubernetes directory into /etc/kubernetes.old-$(date +%Y%m%d) (for example: kubernetes.old-20200325)

If the the script is failed to be executed, use the backup directory to overide the /etc/kubernetes directory.

[root@k8s-master-47 ~]# ls /etc/kubernetes.old-20230829
3.5 k8s修改默认命名空间
kubectl config set-context $(kubectl config current-context) --namespace=soms

四、参考:

  • http://www.taodudu.cc/news/show-3680378.html?action=onClick
  • https://github.com/yuyicai/update-kube-cert
http://www.hrbkazy.com/news/19176.html

相关文章:

  • 做店铺装修的公司网站google引擎免费入口
  • 网站开发作业代做网络安全
  • 门户网站建设jz190网络营销的类型
  • 江苏外协机械加工网适合seo软件
  • 东营做网站优化价格排名点击软件怎样
  • 西部数码做的网站打不开网站策划是做什么的
  • 网站怎么做搜索栏网络营销策划书的结构
  • 申请网站空间怎么做网站运营策划书
  • 雅虎做网站推广浙江百度推广开户
  • 网站建设台州网站外链分析工具
  • 学院 网站 两学一做北京网站优化步骤
  • 国外公共空间设计网站百度学术论文查重免费
  • 网络推广网站电话seo搜索引擎优化步骤
  • 可以看男男做的视频网站google chrome谷歌浏览器
  • 现在的网站推广是怎么做的网站seo优化是什么意思
  • wordpress html音乐全网seo优化电话
  • 北京便宜做网站互动营销名词解释
  • 布吉做棋牌网站建设哪家便宜seo优化在线诊断
  • 国内设计的企业网站百度一下点击搜索
  • 全国工程造价咨询企业管理系统关键词优化的最佳方法
  • 网站上传系统个人发布信息的免费平台
  • vs 2012网站开发万网域名交易
  • wordpress自动生成sitemap网站seo源码
  • wordpress ks主题搜索引擎优化宝典
  • 如何做淘宝cms导购网站百度商家入驻怎么做
  • 外贸网站建设推广公司价格什么是搜索引擎优化
  • wordpress拉黑用户登录seo方法
  • 花生棒做网站信息推广的方式有哪些
  • 计算机网站开发就业形势推广排名seo
  • 麻章网站建设公司郑州高端网站建设