Modify the expiration time of kubeadm certificate
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