kubeSphere+kubernetes 集群更新证书
模拟问题点
使用kubernetes时错误提示
yang@master:~$ kubectl get nodes
Unable to connect to the server: x509: certificate has expired or is not yet valid: current time 2022-10-25T09:04:19+08:00 is after 2022-09-25T08:17:20Z
解决办法:
一、查看证书过期时间
yang@master:~$ sudo kubeadm certs check-expiration
[sudo] password for yang:
[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 -o yaml'
W1027 09:27:32.225497 46147 utils.go:69] The recommended value for "clusterDNS" in "KubeletConfiguration" is: [10.233.0.10]; the provided value is: [169.254.25.10] CERTIFICATE EXPIRES RESIDUAL TIME CERTIFICATE AUTHORITY EXTERNALLY MANAGED
admin.conf Oct 25, 2023 08:17 UTC 363d ca no
apiserver Oct 25, 2023 08:17 UTC 363d ca no
apiserver-kubelet-client Oct 25, 2023 08:17 UTC 363d ca no
controller-manager.conf Oct 25, 2023 08:17 UTC 363d ca no
front-proxy-client Oct 25, 2023 08:17 UTC 363d front-proxy-ca no
scheduler.conf Oct 25, 2023 08:17 UTC 363d ca no CERTIFICATE AUTHORITY EXPIRES RESIDUAL TIME EXTERNALLY MANAGED
ca Oct 22, 2032 08:17 UTC 9y no
front-proxy-ca Oct 22, 2032 08:17 UTC 9y no
二、备份现有证书和重新生成新证书
1.备份现有证书
yang@master:~$ ll /etc/kubernetes/
total 292
drwxr-xr-x 5 kube root 4096 Oct 25 16:18 ./
drwxr-xr-x 101 root root 4096 Oct 26 10:38 ../
drwxrwxr-x 2 kube root 4096 Oct 25 16:18 addons/
-rw------- 1 kube root 5659 Oct 25 16:17 admin.conf
-rw------- 1 kube root 5681 Oct 25 16:17 controller-manager.conf
-rw-r--r-- 1 kube root 925 Oct 25 16:18 coredns-svc.yaml
-rw-r--r-- 1 kube root 2670 Oct 25 16:17 kubeadm-config.yaml
-rw------- 1 kube root 1979 Oct 25 16:18 kubelet.conf
drwxr-xr-x 2 kube root 4096 Oct 25 16:17 manifests/
-rw-r--r-- 1 kube root 230001 Oct 25 16:18 network-plugin.yaml
-rw-r--r-- 1 kube root 1040 Oct 25 16:18 nodelocaldnsConfigmap.yaml
-rw-r--r-- 1 kube root 2775 Oct 25 16:18 nodelocaldns.yaml
drwxr-xr-x 2 kube root 4096 Oct 25 16:17 pki/
-rw------- 1 kube root 5633 Oct 25 16:17 scheduler.conf
yang@master:/home$ sudo mkdir config-back
yang@master:/home$ sudo cp -a /etc/kubenetes/ /home/config-back/
yang@master:~$ ll /home/config-back/kubernetes/
total 292
drwxr-xr-x 5 kube root 4096 Oct 25 16:18 ./
drwxr-xr-x 3 root root 4096 Oct 27 09:29 ../
drwxrwxr-x 2 kube root 4096 Oct 25 16:18 addons/
-rw------- 1 kube root 5659 Oct 25 16:17 admin.conf
-rw------- 1 kube root 5681 Oct 25 16:17 controller-manager.conf
-rw-r--r-- 1 kube root 925 Oct 25 16:18 coredns-svc.yaml
-rw-r--r-- 1 kube root 2670 Oct 25 16:17 kubeadm-config.yaml
-rw------- 1 kube root 1979 Oct 25 16:18 kubelet.conf
drwxr-xr-x 2 kube root 4096 Oct 25 16:17 manifests/
-rw-r--r-- 1 kube root 230001 Oct 25 16:18 network-plugin.yaml
-rw-r--r-- 1 kube root 1040 Oct 25 16:18 nodelocaldnsConfigmap.yaml
-rw-r--r-- 1 kube root 2775 Oct 25 16:18 nodelocaldns.yaml
drwxr-xr-x 2 kube root 4096 Oct 25 16:17 pki/
-rw------- 1 kube root 5633 Oct 25 16:17 scheduler.conf
2.生成新证书
yang@master:~$ sudo kubeadm certs renew all
[renew] Reading configuration from the cluster...
[renew] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'
W1027 09:29:53.913902 49108 utils.go:69] The recommended value for "clusterDNS" in "KubeletConfiguration" is: [10.233.0.10]; the provided value is: [169.254.25.10] certificate embedded in the kubeconfig file for the admin to use and for kubeadm itself renewed
certificate for serving the Kubernetes API renewed
certificate for the API server to connect to kubelet renewed
certificate embedded in the kubeconfig file for the controller manager to use renewed
certificate for the front proxy client renewed
certificate embedded in the kubeconfig file for the scheduler manager to use renewed Done renewing certificates. You must restart the kube-apiserver, kube-controller-manager, kube-scheduler and etcd, so that they can use the new certificates.
三、查看证书有效期
yang@master:~$ sudo kubeadm 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 -o yaml'
W1027 09:31:31.191076 51350 utils.go:69] The recommended value for "clusterDNS" in "KubeletConfiguration" is: [10.233.0.10]; the provided value is: [169.254.25.10] CERTIFICATE EXPIRES RESIDUAL TIME CERTIFICATE AUTHORITY EXTERNALLY MANAGED
admin.conf Oct 27, 2023 01:29 UTC 364d ca no
apiserver Oct 27, 2023 01:29 UTC 364d ca no
apiserver-kubelet-client Oct 27, 2023 01:29 UTC 364d ca no
controller-manager.conf Oct 27, 2023 01:29 UTC 364d ca no
front-proxy-client Oct 27, 2023 01:29 UTC 364d front-proxy-ca no
scheduler.conf Oct 27, 2023 01:29 UTC 364d ca no CERTIFICATE AUTHORITY EXPIRES RESIDUAL TIME EXTERNALLY MANAGED
ca Oct 22, 2032 08:17 UTC 9y no
front-proxy-ca Oct 22, 2032 08:17 UTC 9y no
四、新证书替换老的证书凭证
yang@master:~$ sudo cp -a ~/.kube/config /home/config-back/
yang@master:~$ sudo cp /etc/kubernetes/admin.conf ~/.kube/config
五、查看集群状态
yang@master:~$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
master Ready control-plane,master,worker 41h v1.22.10
node Ready worker 39h v1.22.10
kubeSphere+kubernetes 集群更新证书的更多相关文章
- Centos7部署kubernetes集群CA证书创建和分发(二)
1.解压软件包 [root@linux-node1 ~]# cd /usr/local/src/ [root@linux-node1 src]# ls k8s-v1.10.1-manual.zip [ ...
- 监控Kubernetes集群证书过期时间的三种方案
前言 Kubernetes 中大量用到了证书, 比如 ca证书.以及 kubelet.apiserver.proxy.etcd等组件,还有 kubeconfig 文件. 如果证书过期,轻则无法登录 K ...
- 使用Kubeadm搭建高可用Kubernetes集群
1.概述 Kubenetes集群的控制平面节点(即Master节点)由数据库服务(Etcd)+其他组件服务(Apiserver.Controller-manager.Scheduler...)组成. ...
- 基于TLS证书手动部署kubernetes集群(下)
一.master节点组件部署 承接上篇文章--基于TLS证书手动部署kubernetes集群(上),我们已经部署好了etcd集群.flannel网络以及每个节点的docker,接下来部署master节 ...
- Kubernetes集群中Service的滚动更新
Kubernetes集群中Service的滚动更新 二月 9, 2017 0 条评论 在移动互联网时代,消费者的消费行为已经“全天候化”,为此,商家的业务系统也要保持7×24小时不间断地提供服务以满足 ...
- Kubernetes 集群部署(1) -- 自签 TLS 证书
集群功能各模块功能描述: Master节点:主要由四个模块组成,APIServer,schedule, controller-manager, etcd APIServer: APIServer负责对 ...
- 在 Kubernetes 集群快速部署 KubeSphere 容器平台
KubeSphere 不仅支持部署在 Linux 之上,还支持在已有 Kubernetes 集群之上部署 KubeSphere,自动纳管 Kubernetes 集群的已有资源与容器. 前提条件 Kub ...
- 在 Linux 部署多节点 Kubernetes 集群与 KubeSphere 容器平台
KubeSphere 是在 Kubernetes 之上构建的以应用为中心的企业级容器平台,所有供为用户提供简单易用的操作界面以及向导式操作方式.同时,KubeSphere Installer 提供了 ...
- (转)基于TLS证书手动部署kubernetes集群(下)
转:https://www.cnblogs.com/wdliu/p/9152347.html 一.master节点组件部署 承接上篇文章--基于TLS证书手动部署kubernetes集群(上),我们已 ...
- Kubernetes集群搭建 ver1.20.5
目录 部署方式 1. 基础环境准备 1.1 基础初始化 1.2 安装docker 2. 部署harbor及haproxy高可用反向代理 2.1 镜像加速配置 2.2 高可用master可配置 3. 初 ...
随机推荐
- WeetCode4 —— 二叉树遍历与树型DP
一丶二叉树的遍历 1.二叉树遍历递归写法与递归序 了解过二叉树的朋友,最开始肯定是从二叉树的遍历开始的,二叉树遍历的递归写法想必大家都有所了解. public static void process( ...
- 递归概念&分类&注意事项
递归概念&分类&注意事项 概念 递归:指在当前方法内调用自己的这种现象. 递归的分类:.递归分为两种,直接递归和间接递归..直接递归称为方法自身调用自己..间接递归可以A方法调用B方法 ...
- OpenStack命令行参考
OpenStack命令行参考 hello,大家好,这里是费冰.在使用OpenStack的过程中,固然我们可以通过 web 页面完成绝大多数的操作,但作为管理人员,不能不知晓 OpenStack 命令行 ...
- chunjun同步两个带Kerberos认证的CDH集群数据
最近在项目中遇到同步两个 CDH 数据文件的需求,调研了一圈,发现 datax 不支持两个 cdh 同时进行 kerberos 认证,因此切换到 chunjun,chunjun 在 kerberos ...
- 一把梭:REST API 全用 POST(转载)
一把梭:REST API 全用 POST(转载) 原文链接: https://coolshell.cn/articles/22173.html 写这篇文章的原因主要还是因为V2EX上的这个贴子,这个贴 ...
- 多个仓库源配置及repositories和mirrors的配置
在实际项目中会存在多个仓库,包括我们自建的Nexus私有仓库和阿里仓,这里就需要设置多仓的顺序,防止jar包不在其中一个仓库时会自动从另外一个仓库中拉取. Maven的Setting配置中有mirro ...
- day11-JSON处理和HttpMessageConverter<T>
JOSN处理和HttpMessageConverter 1.JSON处理-@ResponseBody 说明:在实际开发中,我们往往需要服务器返回的数据都是 JSON 格式. SpringMVC 提供了 ...
- 使用vscode调试ros
https://blog.csdn.net/u012254599/article/details/106143540/ CMakeLists.txt set(CMAKE_BUILD_TYPE &quo ...
- 视觉十四讲:第七讲_ORB特征点
1.特征点 特征点是图像里一些特别的地方,如角点.边缘和区块.比较著名有SIFT.SURF.ORB等.SIFT充分考虑了图像变换过程中出现的光照.尺度.旋转等变换,但是计算量非常大.而ORB是质量和性 ...
- NET近期面试总结和面试题
一.面试总结 避坑:深圳龙岗李朗YH股份会鸽offer 因为offer被鸽重新找工作,从8号开始面试到12号(11家公司),整体感觉面试难度不大,就是很多公司都是走流程,并不是真的需要人,有些甚至聊一 ...