Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Modify the expiration time of kubeadm certificate

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Three-step installation of kubernetes cluster

Modify the expiration time of kubeadm certificate

In this paper, the default one-year certificate expiration time of kubeadm is changed to 1999 by modifying the kubeadm source code.

I have compiled one and put it on github. If you need it, you can download it directly.

Code compilation

I have put the compiled environment image on dockerhub: fanux/kubernetes-build:v1.0.0

First, the clone K8s code:

Git clone https://github.com/kubernetes/kubernetes

Mount it to the image to compile

Docker run-- rm-v yourcodedir:/go/src/k8s.io/kubernetes-it fanux/kubernetes-build:v1.0.0 bash# cd / go/src/k8s.io/kubernetes# make all WHAT=cmd/kubeadm GOFLAGS=-v

The compiled product is in the _ output/local/bin/linux/amd64/kubeadm directory.

Modify the code

The certificate time code is actually in client-go, and the file is:

Vendor/k8s.io/client-go/util/cert/cert.go

Then you can see that all the NotAfter files have been changed:

NotAfter: validFrom.Add (duration365d * longYear)

I have longYear = 99.

And then compiled and finished.

Finally, put a small ad in the code:

Func main () {if err: = app.Run () Err! = nil {fmt.Fprintf (os.Stderr, "error:% v\ n" Err) os.Exit (1)} fmt.Println ("*") fmt.Println ("* × × w.sealyun.com * *") fmt.Println ("*) Kubernetes install in 3 steps * * ") fmt.Println (" * provide by fanux * * ") fmt.Println (" * ") os.Exit (0)}

Perfect

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report