k8s之kubelet证书时间过期升级
1.查看当前证书时间
# kubeadm alpha certs renew kubelet
Kubeadm experimental sub-commands
kubeadm是一个用于引导Kubernetes集群的工具,它提供了许多命令和子命令来管理集群的一生周期。过去,某些功能被标记为实验性的,并通过kubeadm alpha子命令进行访问。然而,从Kubernetes 1.15版本开始,kubeadm将这些功能从alpha子命令迁移到了稳定的命令中。在新版本中,使用kubeadm certs renew kubelet即可
检查
# 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'CERTIFICATE EXPIRES RESIDUAL TIME CERTIFICATE AUTHORITY EXTERNALLY MANAGED
admin.conf Mar 26, 2025 08:52 UTC 286d ca no
apiserver Mar 26, 2025 08:52 UTC 286d ca no
apiserver-etcd-client Mar 26, 2025 08:52 UTC 286d etcd-ca no
apiserver-kubelet-client Mar 26, 2025 08:52 UTC 286d ca no
controller-manager.conf Mar 26, 2025 08:52 UTC 286d ca no
etcd-healthcheck-client Mar 26, 2025 08:52 UTC 286d etcd-ca no
etcd-peer Mar 26, 2025 08:52 UTC 286d etcd-ca no
etcd-server Mar 26, 2025 08:52 UTC 286d etcd-ca no
front-proxy-client Mar 26, 2025 08:52 UTC 286d front-proxy-ca no
scheduler.conf Mar 26, 2025 08:52 UTC 286d ca no CERTIFICATE AUTHORITY EXPIRES RESIDUAL TIME EXTERNALLY MANAGED
ca Mar 24, 2034 08:52 UTC 9y no
etcd-ca Mar 24, 2034 08:52 UTC 9y no
front-proxy-ca Mar 24, 2034 08:52 UTC 9y no
kubelet证书时间只有1年有效期。
# openssl x509 -in kubelet.crt -noout -text | grep "Not"Not Before: Mar 26 07:52:16 2024 GMTNot After : Mar 26 07:52:16 2025 GMT
备份原证书
# mkdir backup_certs
# cd backup_certs/# cp /usr/bin/kube* .
# ll
total 211260
-rwxr-x--- 1 root root 45210392 Jun 13 15:15 kubeadm
-rwxr-x--- 1 root root 46592216 Jun 13 15:15 kubectl
-rwxr-x--- 1 root root 124521288 Jun 13 15:15 kubelet# cp -r /etc/kubernetes/pki .
]# ll
total 211264
-rwxr-x--- 1 root root 45210392 Jun 13 15:15 kubeadm
-rwxr-x--- 1 root root 46592216 Jun 13 15:15 kubectl
-rwxr-x--- 1 root root 124521288 Jun 13 15:15 kubelet
drwxr-x--- 3 root root 4096 Jun 13 15:18 pki
删除旧证书
# rm -rf /etc/kubernetes/pki/*
生成新证书
# kubeadm certs renew -h
This command is not meant to be run on its own. See list of available subcommands.Usage:kubeadm certs renew [flags]kubeadm certs renew [command]Available Commands:admin.conf Renew the certificate embedded in the kubeconfig file for the admin to use and for kubeadm itselfall Renew all available certificatesapiserver Renew the certificate for serving the Kubernetes APIapiserver-etcd-client Renew the certificate the apiserver uses to access etcdapiserver-kubelet-client Renew the certificate for the API server to connect to kubeletcontroller-manager.conf Renew the certificate embedded in the kubeconfig file for the controller manager to useetcd-healthcheck-client Renew the certificate for liveness probes to healthcheck etcdetcd-peer Renew the certificate for etcd nodes to communicate with each otheretcd-server Renew the certificate for serving etcdfront-proxy-client Renew the certificate for the front proxy clientscheduler.conf Renew the certificate embedded in the kubeconfig file for the scheduler manager to useFlags:-h, --help help for renewGlobal Flags:--add-dir-header If true, adds the file directory to the header of the log messages--log-file string If non-empty, use this log file--log-file-max-size uint Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)--one-output If true, only write logs to their native severity level (vs also writing to each lower severity level)--rootfs string [EXPERIMENTAL] The path to the 'real' host root filesystem.--skip-headers If true, avoid header prefixes in the log messages--skip-log-headers If true, avoid headers when opening log files-v, --v Level number for the log level verbosityUse "kubeadm certs renew [command] --help" for more information about a command.
生成某个证书
升级哪个证书,就生成哪个组件的证书,保险,就生成所有证书
# kubeadm certs renew apiserver-kubelet-client
[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'certificate for the API server to connect to kubelet renewed
生成所有证书
# 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'certificate embedded in the kubeconfig file for the admin to use and for kubeadm itself renewed
certificate for serving the Kubernetes API renewed
certificate the apiserver uses to access etcd 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 liveness probes to healthcheck etcd renewed
certificate for etcd nodes to communicate with each other renewed
certificate for serving etcd renewed
certificate for the front proxy client renewed
certificate embedded in the kubeconfig file for the scheduler manager to use renewedDone renewing certificates. You must restart the kube-apiserver, kube-controller-manager, kube-scheduler and etcd, so that they can use the new certificates.
查看配置已经更新
# ll /etc/kubernetes/
total 32
-rwxrwxrwx 1 root root 5640 Jun 13 15:26 admin.conf
-rw------- 1 root root 5668 Jun 13 15:26 controller-manager.conf
-rw------- 1 root root 2004 Mar 26 16:52 kubelet.conf
drwxr-xr-x 2 root root 113 May 29 17:12 manifests
drwxr-x--- 3 root root 4096 Mar 26 16:52 pki
-rw------- 1 root root 5620 Jun 13 15:26 scheduler.conf
生成新配置
查看帮助
# kubeadm init phase kubeconfig -h
This command is not meant to be run on its own. See list of available subcommands.Usage:kubeadm init phase kubeconfig [flags]kubeadm init phase kubeconfig [command]Available Commands:admin Generate a kubeconfig file for the admin to use and for kubeadm itselfall Generate all kubeconfig filescontroller-manager Generate a kubeconfig file for the controller manager to usekubelet Generate a kubeconfig file for the kubelet to use *only* for cluster bootstrapping purposesscheduler Generate a kubeconfig file for the scheduler to useFlags:-h, --help help for kubeconfigGlobal Flags:--add-dir-header If true, adds the file directory to the header of the log messages--log-file string If non-empty, use this log file--log-file-max-size uint Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)--one-output If true, only write logs to their native severity level (vs also writing to each lower severity level)--rootfs string [EXPERIMENTAL] The path to the 'real' host root filesystem.--skip-headers If true, avoid header prefixes in the log messages--skip-log-headers If true, avoid headers when opening log files-v, --v Level number for the log level verbosityUse "kubeadm init phase kubeconfig [command] --help" for more information about a command.
生成某个配置
失败是正常,版本垮裤较大,而且也只更新证书有效期
# kubeadm init phase kubeconfig admin
I0613 15:31:07.518079 30859 version.go:255] remote version is much newer: v1.30.2; falling back to: stable-1.23
W0613 15:31:17.521449 30859 version.go:103] could not fetch a Kubernetes version from the internet: unable to get URL "https://dl.k8s.io/release/stable-1.23.txt": Get "https://cdn.dl.k8s.io/release/stable-1.23.txt": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
W0613 15:31:17.521573 30859 version.go:104] falling back to the local client version: v1.23.4
生成所有配置
# kubeadm init phase kubeconfig all
W0613 15:45:39.731181 7842 version.go:103] could not fetch a Kubernetes version from the internet: unable to get URL "https://dl.k8s.io/release/stable-1.txt": Get "https://cdn.dl.k8s.io/release/stable-1.txt": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
W0613 15:45:39.731479 7842 version.go:104] falling back to the local client version: v1.23.4
[kubeconfig] Using kubeconfig folder "/etc/kubernetes"
[kubeconfig] Using existing kubeconfig file: "/etc/kubernetes/admin.conf"
[kubeconfig] Using existing kubeconfig file: "/etc/kubernetes/kubelet.conf"
[kubeconfig] Using existing kubeconfig file: "/etc/kubernetes/controller-manager.conf"
[kubeconfig] Using existing kubeconfig file: "/etc/kubernetes/scheduler.conf"
重启kubelet
# systemctl status kubelet.service | grep ActiveActive: active (running) since Tue 2024-03-26 16:52:52 CST; 2 months 18 days ago# systemctl restart kubelet.service # systemctl status kubelet.service | grep ActiveActive: active (running) since Thu 2024-06-13 15:47:19 CST; 3s ago
更新admin.conf文件
# cp /etc/kubernetes/admin.conf ~/.kube/config
cp: overwrite ‘/root/.kube/config’? y
2.检查证书有效期
# 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'CERTIFICATE EXPIRES RESIDUAL TIME CERTIFICATE AUTHORITY EXTERNALLY MANAGED
admin.conf Jun 13, 2025 07:26 UTC 364d ca no
apiserver Jun 13, 2025 07:26 UTC 364d ca no
apiserver-etcd-client Jun 13, 2025 07:26 UTC 364d etcd-ca no
apiserver-kubelet-client Jun 13, 2025 07:26 UTC 364d ca no
controller-manager.conf Jun 13, 2025 07:26 UTC 364d ca no
etcd-healthcheck-client Jun 13, 2025 07:26 UTC 364d etcd-ca no
etcd-peer Jun 13, 2025 07:26 UTC 364d etcd-ca no
etcd-server Jun 13, 2025 07:26 UTC 364d etcd-ca no
front-proxy-client Jun 13, 2025 07:26 UTC 364d front-proxy-ca no
scheduler.conf Jun 13, 2025 07:26 UTC 364d ca no CERTIFICATE AUTHORITY EXPIRES RESIDUAL TIME EXTERNALLY MANAGED
ca Mar 24, 2034 08:52 UTC 9y no
etcd-ca Mar 24, 2034 08:52 UTC 9y no
front-proxy-ca Mar 24, 2034 08:52 UTC 9y no
查看各证书时间
# openssl x509 -in /etc/kubernetes/pki/apiserver.crt -noout -textNot Before: Mar 26 08:52:10 2024 GMTNot After : Jun 13 07:26:54 2025 GMT
# openssl x509 -in /etc/kubernetes/pki/apiserver-etcd-client.crt -noout -textNot Before: Mar 26 08:52:11 2024 GMTNot After : Jun 13 07:26:55 2025 GMT
# openssl x509 -in /etc/kubernetes/pki/apiserver-kubelet-client.crt -noout -textNot Before: Mar 26 08:52:10 2024 GMTNot After : Jun 13 07:26:55 2025 GMT
# openssl x509 -in /etc/kubernetes/pki/ca.crt -noout -textNot Before: Mar 26 08:52:10 2024 GMTNot After : Mar 24 08:52:10 2034 GMT
# openssl x509 -in /etc/kubernetes/pki/front-proxy-ca.crt -noout -textNot Before: Mar 26 08:52:10 2024 GMTNot After : Mar 24 08:52:10 2034 GMT
# openssl x509 -in /etc/kubernetes/pki/front-proxy-client.crt -noout -textNot Before: Mar 26 08:52:10 2024 GMTNot After : Jun 13 07:26:57 2025 GMT
查看k8s环境

相关文章:
k8s之kubelet证书时间过期升级
1.查看当前证书时间 # kubeadm alpha certs renew kubelet Kubeadm experimental sub-commands kubeadm是一个用于引导Kubernetes集群的工具,它提供了许多命令和子命令来管理集群的一生周期。过去,某些功能被标记为实验性的,并通过kubeadm a…...
5G消息 x 文旅 | 一站式智慧文旅解决方案
5G消息 x 文旅 | 一站式智慧文旅解决方案 文旅 x 5G 消息将进一步强化资源整合,满足游客服务需求、企业营销需求、政府管理需求,推进文化旅游项目的智慧化、数字化,增强传播力、竞争力和可持续性。5G 消息的“原生入口”、“超强呈现”、“智…...
如何评估员工在新版FMEA培训后应用知识的效果?
随着制造业的快速发展,新版FMEA已成为企业提升产品质量、减少故障风险的关键一环。然而,培训只是第一步,如何有效评估员工在新版FMEA培训后应用知识的效果,才是确保培训成果转化的关键所在。 评估员工知识应用效果的首要步骤是制定…...
python脚本之解析命令参数
import requests import argparseprint(f"{__name__}:start")parser argparse.ArgumentParser(description使用方法) parser.add_argument(-p, --prefix, typestr, help域名) parser.add_argument(-t, --token, typestr, helptoken) parser.add_argument(-i, --queu…...
当JS遇上NLP:开启图片分析的奇幻之旅
前言 在当今科技飞速发展的时代,JavaScript(JS)作为广泛应用的编程语言,展现出了强大的活力与无限的可能性。与此同时,自然语言处理(NLP)领域也正在经历着深刻的变革与进步。 当这两者碰撞在一…...
trpc快速上手
tRPC (Type-safe Remote Procedure Call) 是一个用于构建类型安全的 API 的框架,它能够在前端和后端之间共享类型,确保类型安全性。这对于使用 TypeScript 的项目特别有用,因为它消除了前后端类型不一致的问题,提高了开发效率和代…...
知识图谱存在的挑战---隐私、安全和伦理相关和测试认证相关
文章目录 隐私、安全和伦理相关测试认证相关 隐私、安全和伦理相关 从部署拓扑结构而言,知识图谱技术以数据为核心、数据库为载体的方式来存储,有单机、云平台、集群及其组合的部署方式,结合大数据平台、云平台、业务系统、灾备、网络系统及其…...
课时155:脚本发布_简单脚本_命令罗列
2.1.1 命令罗列 学习目标 这一节,我们从 基础知识、简单实践、小结 三个方面来学习 基础知识 简介 目的:实现代码仓库主机上的操作命令功能即可简单实践 实践 查看脚本内容 #!/bin/bash # 功能:打包代码 # 版本: v0.1 # 作者: 书记 # …...
借助ollama实现AI绘画提示词自由,操作简单只需一个节点!
只需要将ollama部署到本地,借助comfyui ollama节点即可给你的Ai绘画提示词插上想象的翅膀。具体看详细步骤! 第一步打开ollama官网:https://ollama.com/,并选择models显存太小选择的是llama3\8b参数的instruct-q6_k的这个模型。 运…...
PyTorch -- Visdom 快速实践
安装:pip install visdom 注:如果安装后启动报错可能是 visdom 版本选择问题 启动:python -m visdom.server 之后打开出现的链接 http://localhost:8097Checking for scripts. Its Alive! INFO:root:Application Started INFO:root:Working…...
基于xilinx FPGA的QSFP调试使用经验
1 概述 本文用于记录QSFP在调试使用时遇到的一些经验教训,防止后来者踩相同的坑。 参考手册: 《AMQ28-SR4-M1_V1.0》 《QSFP-DD-Hardware-rev4p0-9-12-18-clean》 2 QSFP简介 QSFP(Quad Small Form-facor Pluggable)即四通道SFP…...
WPF 使用Image控件显示图片
Source属性 Source属性用来告诉Image组件要展示哪张图片资源的一个入口,通常是图片的路径。也许是本地路径,也许是网络路径。 本地图片路径加载方式 使用相对路径,相对于工程目录的路径,当设置Width属性时,图片会等…...
合肥工业大学内容安全实验一:爬虫|爬新闻文本
✅作者简介:CSDN内容合伙人、信息安全专业在校大学生🏆 🔥系列专栏 :合肥工业大学实验课设 📃新人博主 :欢迎点赞收藏关注,会回访! 💬舞台再大,你不上台,永远是个观众。平台再好,你不参与,永远是局外人。能力再大,你不行动,只能看别人成功!没有人会关心你付…...
自动驾驶---Perception之视觉点云雷达点云
1 前言 在自动驾驶领域,点云技术的发展历程可以追溯到自动驾驶技术的早期阶段,特别是在环境感知和地图构建方面。 在自动驾驶技术的早期技术研究中,视觉点云和和雷达点云都有出现。20世纪60年代,美国MIT的Roberts从2D图像中提取3D…...
maven 显式依赖包包含隐式依赖包,引起依赖包冲突
问题:FlinkCDC 3.0.1 代码 maven依赖包冲突 什么是依赖冲突 依赖冲突是指项目依赖的某一个jar包,有多个不同的版本,因而造成类包版本冲突 依赖冲突的原因 依赖冲突很经常是类包之间的间接依赖引起的。每个显式声明的类包都会依赖于一些其它…...
Spring应用如何打印access日志和out日志(用于分析请求总共在服务耗费多长时间)
我们经常会被问到这样一个问题。你接口返回的好慢呀,能不能提升一下接口响应时间啊?这个时候我们就需要去分析,为什么慢,慢在哪。而这首先应该做的就是确定接口返回时间过长确实是在服务内消耗的时间。而不是我们将请求发给网关或…...
SpringBoot整合SpringDataRedis
目录 1.导入Maven坐标 2.配置相关的数据源 3.编写配置类 4.通过RedisTemplate对象操作Redis SpringBoot整合Redis有很多种,这里使用的是Spring Data Redis。接下来就springboot整合springDataRedis步骤做一个详细介绍。 1.导入Maven坐标 首先,需要导…...
电脑怎么录制游戏视频?轻松捕捉每一帧精彩
随着游戏产业的蓬勃发展,越来越多的玩家不仅满足于在游戏世界中的探索与冒险,更希望将自己的游戏精彩瞬间记录下来,分享给更多的朋友。可是电脑怎么录制游戏视频呢?本文旨在为广大游戏爱好者提供一份详细的电脑游戏视频录制攻略&a…...
【Elasticsearch】索引快照并还原到其他集群
【Elasticsearch】索引快照并还原到其他集群 前提:es节点的所有用户id和组id都需要相同,最好在新建集群时指定用户id和组id,否则挂载后执行curl时会提示权限报错。 解决方法(gpt生成),不敢在生产尝试。 点…...
QT--DAY1
不使用图形化界面实现一个登陆界面 #include "widget.h"Widget::Widget(QWidget *parent): QWidget(parent) {//设置窗口标题this->setWindowTitle("登录界面");//设置窗口大小this->resize(535,410);//固定窗口大小this->setFixedSize(535,410)…...
大数据学习栈记——Neo4j的安装与使用
本文介绍图数据库Neofj的安装与使用,操作系统:Ubuntu24.04,Neofj版本:2025.04.0。 Apt安装 Neofj可以进行官网安装:Neo4j Deployment Center - Graph Database & Analytics 我这里安装是添加软件源的方法 最新版…...
Redis相关知识总结(缓存雪崩,缓存穿透,缓存击穿,Redis实现分布式锁,如何保持数据库和缓存一致)
文章目录 1.什么是Redis?2.为什么要使用redis作为mysql的缓存?3.什么是缓存雪崩、缓存穿透、缓存击穿?3.1缓存雪崩3.1.1 大量缓存同时过期3.1.2 Redis宕机 3.2 缓存击穿3.3 缓存穿透3.4 总结 4. 数据库和缓存如何保持一致性5. Redis实现分布式…...
连锁超市冷库节能解决方案:如何实现超市降本增效
在连锁超市冷库运营中,高能耗、设备损耗快、人工管理低效等问题长期困扰企业。御控冷库节能解决方案通过智能控制化霜、按需化霜、实时监控、故障诊断、自动预警、远程控制开关六大核心技术,实现年省电费15%-60%,且不改动原有装备、安装快捷、…...
在 Nginx Stream 层“改写”MQTT ngx_stream_mqtt_filter_module
1、为什么要修改 CONNECT 报文? 多租户隔离:自动为接入设备追加租户前缀,后端按 ClientID 拆分队列。零代码鉴权:将入站用户名替换为 OAuth Access-Token,后端 Broker 统一校验。灰度发布:根据 IP/地理位写…...
spring:实例工厂方法获取bean
spring处理使用静态工厂方法获取bean实例,也可以通过实例工厂方法获取bean实例。 实例工厂方法步骤如下: 定义实例工厂类(Java代码),定义实例工厂(xml),定义调用实例工厂ÿ…...
DIY|Mac 搭建 ESP-IDF 开发环境及编译小智 AI
前一阵子在百度 AI 开发者大会上,看到基于小智 AI DIY 玩具的演示,感觉有点意思,想着自己也来试试。 如果只是想烧录现成的固件,乐鑫官方除了提供了 Windows 版本的 Flash 下载工具 之外,还提供了基于网页版的 ESP LA…...
相机从app启动流程
一、流程框架图 二、具体流程分析 1、得到cameralist和对应的静态信息 目录如下: 重点代码分析: 启动相机前,先要通过getCameraIdList获取camera的个数以及id,然后可以通过getCameraCharacteristics获取对应id camera的capabilities(静态信息)进行一些openCamera前的…...
【git】把本地更改提交远程新分支feature_g
创建并切换新分支 git checkout -b feature_g 添加并提交更改 git add . git commit -m “实现图片上传功能” 推送到远程 git push -u origin feature_g...
Caliper 配置文件解析:config.yaml
Caliper 是一个区块链性能基准测试工具,用于评估不同区块链平台的性能。下面我将详细解释你提供的 fisco-bcos.json 文件结构,并说明它与 config.yaml 文件的关系。 fisco-bcos.json 文件解析 这个文件是针对 FISCO-BCOS 区块链网络的 Caliper 配置文件,主要包含以下几个部…...
[Java恶补day16] 238.除自身以外数组的乘积
给你一个整数数组 nums,返回 数组 answer ,其中 answer[i] 等于 nums 中除 nums[i] 之外其余各元素的乘积 。 题目数据 保证 数组 nums之中任意元素的全部前缀元素和后缀的乘积都在 32 位 整数范围内。 请 不要使用除法,且在 O(n) 时间复杂度…...
