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. 初 ...
随机推荐
- Java基础学习笔记-类的静态属性和静态方法--待继续补充
程序运行时的内存占用 代码区(code area) 存放代码 数据区(data area) 存放全局数据.静态数据 堆区(heap area) 存放动态申请的数据 栈区(stack area) 存放局 ...
- 商城网站商品sku选择的js简易实现
商城网站商品sku选择的js简易实现 <!DOCTYPE HTML> <html lang="en-US"> <head> <meta c ...
- 特定领域知识图谱融合方案:文本匹配算法(Simnet、Simcse、Diffcse)
特定领域知识图谱融合方案:文本匹配算法(Simnet.Simcse.Diffcse) 本项目链接:https://aistudio.baidu.com/aistudio/projectdetail/5 ...
- 【学习笔记】XR872 GUI Littlevgl 8.0 移植(显示部分)
LVGL 介绍 官方网站:LVGL - Light and Versatile Embedded Graphics Library 源码位置:GitHub - lvgl/lvgl: Powerful ...
- MySQL-字段约束条件
1.无符号.零填充 1.unsigned:用在生成表的过程中,表示不取负数,只取正数和0,负数会直接报错,eg:id int unsigned. 2.zerofill:用在生成表的过程中,跟在整形2后 ...
- element ui el-date-picker 禁止选择指定日期
1.日期选择器组件代码 <el-col :span="20"> <el-form-item label="活动起始日期值" prop=&quo ...
- 一个比 Redis 性能更强的数据库
给大家推荐一个比Redis性能更强的数据:KeyDB KeyDB是Redis的高性能分支,侧重于多线程.内存效率和高吞吐量.除了性能改进外,KeyDB还提供主动复制.闪存和子密钥过期等功能.KeyDB ...
- 安卓逆向 IDA 静态调试分析
1.找到我们分析的接口 2.F5进入C伪代码 修正一下参数,IDA无法正常识别 jstring __fastcall Java_com_example_sfs_MainActivity_getText ...
- JAVASE小练习 (今天做一个基于javase的银行ATM小练习)
实现的功能有1,用户登录2,用户开户(基于用户登录)3,查询账户(基于用户登录)4,存款5,取款6,转账7,修改密码(只有三次确认密码的机会)8,退出登录9,注销 这个小例子可以让我们充分复习所学的j ...
- CentOS7一键安装RPM版LNMP(NGINX+PHP+MySQL)环境
转载:简书 CentOS7一键安装RPM版LNMP(NGINX+PHP+MySQL)环境 - 简书 (jianshu.com) (需要配置nginx.conf文件) 转载:csdn (35条消息) V ...