k8s-1.28.1证书更新到100年-cenots7.9
一、查看信息# cat /etc/redhat-release
# kubeadm version
https://i-blog.csdnimg.cn/direct/74f3e843409d40d593eb1956ebb04ac9.png
k8s情况是通过kubeadm进行安装的。
二、安装依赖工具
# yum groupinstall "Development Tools" -y
# yum install gcc make -y
# yum install rsync jq -y
三、下载相应版本的k8s包
## 下载地址:
# https://github.com/kubernetes/kubernetes/releases/tag/v1.28.1
## 下载连接
# https://github.com/kubernetes/kubernetes/archive/refs/tags/v1.28.1.tar.gz
## 解压
# tar -zxf kubernetes-1.28.1.tar.gz
# mv kubernetes-1.28.1 kubernetes
# cd kubernetes/ https://i-blog.csdnimg.cn/direct/c343e2d5dc6d49dbbb4aa7959e314f16.png
四、修改证书有用期
# vi ./staging/src/k8s.io/client-go/util/cert/cert.go
把NotAfter: now.Add(duration365d * 10).UTC(),
改成
NotAfter: now.Add(duration365d * 100).UTC(),
# vi ./cmd/kubeadm/app/constants/constants.go
把CertificateValidity = time.Hour * 24 * 365
改成
CertificateValidity = time.Hour * 24 * 365 * 100 https://i-blog.csdnimg.cn/direct/7f171672cd5d47febc2d11eb051cefb5.png
https://i-blog.csdnimg.cn/direct/f10a4189e51b4f1aa8856ebfa19da285.png
检验是否修改:
https://i-blog.csdnimg.cn/direct/b1d6d318fedf41558c6a60e86da48428.png
五、安装golang情况
查看kubenetesv1.28.1版本中的go版本:
https://i-blog.csdnimg.cn/direct/d173aca96d1a4ef2bfd36c4afc3a89ed.png
## 下载地址:
# https://golang.google.cn/dl/
## 下载连接
# https://golang.google.cn/dl/go1.20.7.linux-amd64.tar.gz
# tar -zxf go1.20.7.linux-amd64.tar.gz -C /usr/local
## 配置变量,在/etc/profile增加下面内容
##go setting (sysin)
export GOROOT=/usr/local/go
export GOPATH=/usr/local/gopath
export PATH=$PATH:$GOROOT/bin
# source /etc/profile https://i-blog.csdnimg.cn/direct/524c56106dd341918c61f38c339c4815.png
https://i-blog.csdnimg.cn/direct/329d15307334438fb85c20a81a9b394b.png
六、编译
# pwd
/tmp/v1.28.1/kubernetes
# make all WHAT=cmd/kubeadm GOFLAGS=-v
# make all WHAT=cmd/kubelet GOFLAGS=-v
# make all WHAT=cmd/kubectl GOFLAGS=-v
## 编译完成的在
# ls _output/local/bin/linux/amd64/
kubeadmkubectlkubelet https://i-blog.csdnimg.cn/direct/45f2f5b9a5cb47df972ac5cf1655ae8b.png
七、替换原有kubeadm命令
# mv /usr/bin/kubeadm /usr/bin/kubeadm`date +%F`
# cp _output/local/bin/linux/amd64/kubeadm /usr/bin/kubeadm
# chmod +x /usr/bin/kubeadm
https://i-blog.csdnimg.cn/direct/d9538615a24c411abc08c81b1e67f448.png
八、续订证书
# kubeadm certs renew all
# kubeadm certs check-expiration
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页:
[1]