当前位置:网站首页>Kubernetes 证书可用年限修改
Kubernetes 证书可用年限修改
2022-07-31 05:09:00 【hunheidaode】
证书可用年限修改
[[email protected] pki]# openssl x509 -in apiserver.crt -text -noout
先下载kubeadm的源码,针对apiserver一年年限证书分发的函数进行修改,由1年改为10年。(需要go语言的环境)
1.go语言环境
[[email protected] data]# tar -zxvf go1.16.5.linux-amd64.tar.gz -C /usr/local
[[email protected] data]# vim /etc/profile
export PATH=$PATH:/usr/local/go/bin
[[email protected] data]# source /etc/profile
[[email protected] data]# go version
- 1
- 2
- 3
- 4
- 5
2.下载kubernetes源码
[[email protected] data]# git clone https://github.com/kubernetes/kubernetes.git
[[email protected] data]# cd kubernetes
[[email protected] kubernetes]# kubeadm version
kubeadm version: &version.Info{Major:"1", Minor:"15", GitVersion:"v1.21.2",
[[email protected] kubernetes]# git checkout -b remotes/origin/release-1.21.2 v1.21.2
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
3.修改Kubeadm源码包更新证书策略
[[email protected] kubernetes]# vim staging/src/k8s.io/client-go/util/cert/cert.go
# kubeadm 1.14 版本之前
vi cmd/kubeadm/app/constants/constants.go
# kubeadm 1.21.2 至今
// NewSignedCert {
const duration365d = time.Hour * 24 * 365 * 100
NotAfter: time.Now().Add(duration365d).UTC(),
}
[[email protected] kubernetes]# make WHAT=cmd/kubeadm GOFLAGS=-v
[[email protected] kubernetes]# cp /usr/bin/kubeadm /usr/bin/kubeadm.old
[[email protected] kubernetes]# cp _output/bin/kubeadm /usr/bin/kubeadm
[[email protected] kubernetes]# chmod a+x /usr/bin/kubeadm
[[email protected] kubernetes]# cd /etc/kubernetes/
[[email protected] kubernetes]# cp -r pki /pki.old
新证书生成
[[email protected] ~]# kubeadm certs renew all --config=/root/kubeadm_init/kubeadm-config.yaml
--config是当初安装k8s集群的yaml文件
[[email protected] ~]# cd /etc/kubernetes/pki
查看证书年限
[[email protected] pki]# openssl x509 -in apiserver.crt -text -noout
查看kubeadm-config.yaml位置
[[email protected] pki]# cd /etc/kubernetes/pki/
openssl x509 -in apiserver.crt -text -noout
k8sv1.19.10版本:
需要加alpha命令才行
kubeadm alpha certs renew all --config=/root/kubeadm_init/kubeadm-config.yaml
查看全部证书过期时间也需要加alpha
kubeadm alpha certs check-expiration
边栏推荐
- On-line monitoring system for urban waterlogging and water accumulation in bridges and tunnels
- The MySQL database installed configuration nanny level tutorial for 8.0.29 (for example) have hands
- pycharm专业版使用
- 【一起学Rust】Rust学习前准备——注释和格式化输出
- 12个MySQL慢查询的原因分析
- What are the advantages and disadvantages of Unity shader forge and the built-in shader graph?
- mysql使用on duplicate key update批量更新数据
- a different object with the same identifier value was already associated with the session
- SQL row-column conversion
- Information System Project Manager Core Test Site (55) Configuration Manager (CMO) Work
猜你喜欢
[C language] Detailed explanation of operators
DVWA shooting range environment construction
ES 源码 API调用链路源码分析
MySQL transaction (transaction) (this is enough..)
Typec手机有线网卡网线转网口转接口快充方案
mysql uses on duplicate key update to update data in batches
MySQL8.0.26安装配置教程(windows 64位)
[mysql improves query efficiency] Mysql database query is slow to solve the problem
SQL行列转换
2022-07-30:以下go语言代码输出什么?A:[]byte{} []byte;B:[]byte{} []uint8;C:[]uint8{} []byte;D:[]uin8{} []uint8。
随机推荐
SQL statement to range query time field
ERROR 2003 (HY000) Can't connect to MySQL server on 'localhost3306' (10061)
TOGAF之架构标准规范(一)
Input length must be multiple of 8 when decrypting with padded cipher
Typec手机有线网卡网线转网口转接口快充方案
Unity教程:URP渲染管线实战教程系列【1】
Goodbye to the cumbersome Excel, mastering data analysis and processing technology depends on it
centos7安装mysql5.7
PCL calculates the point cloud coordinate maximum and its index
【ORACLE Explain 详解】
ES 源码 API调用链路源码分析
Temporal对比Cadence
太厉害了,终于有人能把文件上传漏洞讲的明明白白了
Doris学习笔记之监控
DVWA安装教程(懂你的不懂·详细)
The monitoring of Doris study notes
面试官竟然问我怎么分库分表?幸亏我总结了一套八股文
Minio upload file ssl certificate is not trusted
Minesweeper game (written in c language)
MySQL(更新中)