kubernetes1.18.2 修改证书到期时间
1.下载kubernetes源码包
2.修改证书时间
cd /opt/kubernetes/cmd/kubeadm/app/util/pkiutil
修改pki_helpers.go
[root@k8s-harbor pkiutil]# vi pki_helpers.go
增加:const duration365d = time.Hour * 24 * 365 * 10
修改:NotAfter: time.Now().Add(duration365d).UTC(),
3.选择需要编译的分支
[root@k8s-harbor kubernetes]# git checkout -b remotes/origin/release-1.18.2 v1.18.2 M cmd/kubeadm/app/util/pkiutil/pki_helpers.go M staging/src/k8s.io/client-go/util/cert/cert.go
4.编译
[root@k8s-harbor kubernetes]# make WHAT=cmd/kubeadm GOFLAGS=-v warning: ignoring symlink /opt/kubernetes/_output/local/go/src/k8s.io/kubernetes go: warning: "k8s.io/kubernetes/vendor/github.com/go-bindata/go-bindata/..." matched no packages +++ [0730 08:55:42] Building go targets for linux/amd64: cmd/kubeadm k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/net k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/watch k8s.io/kubernetes/vendor/k8s.io/client-go/transport k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1 ... ... k8s.io/kubernetes/cmd/kubeadm/app/discovery/https k8s.io/kubernetes/vendor/k8s.io/client-go/util/certificate/csr k8s.io/kubernetes/vendor/k8s.io/client-go/kubernetes/fake k8s.io/kubernetes/cmd/kubeadm/app/util/apiclient k8s.io/kubernetes/cmd/kubeadm/app/util/config k8s.io/kubernetes/cmd/kubeadm/app/cmd/phases/join k8s.io/kubernetes/cmd/kubeadm/app/phases/upgrade k8s.io/kubernetes/cmd/kubeadm/app/cmd/phases/upgrade/node k8s.io/kubernetes/cmd/kubeadm/app/cmd/upgrade k8s.io/kubernetes/cmd/kubeadm/app/cmd [root@k8s-harbor kubernetes]#
5.拷贝kubeadm
[root@k8s-harbor kubernetes]# cd _output/bin/ [root@k8s-harbor bin]# ls conversion-gen deepcopy-gen defaulter-gen go2make go-bindata kubeadm openapi-gen prerelease-lifecycle-gen