cd /usr/local/src/
git clone -b release-1.15 https://github.com/kubernetes/kubernetes.git
cd kubernetes
git branch -a
vim ./staging/src/k8s.io/client-go/util/cert/cert.go
NotBefore: now.UTC(),
#修改下边的10为100
NotAfter: now.Add(duration365d * 10).UTC(),
KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,
BasicConstraintsValid: true,
IsCA:
vim ./cmd/kubeadm/app/constants/constants.go
// CertificateValidity defines the validity for all the signed certificates generated by kubeadm
#将下边time.Hour * 100
CertificateValidity = time.Hour * 24 * 365
修改后如下:
vim ./cmd/kubeadm/app/constants/constants.go
// CertificateValidity defines the validity for all the signed certificates generated by kubeadm
CertificateValidity = time.Hour * 24 * 365 * 100
docker pull mirrorgooglecontainers/kube-cross:v1.12.10-1
官方提供的编译镜像,无论如何弄到服务器上就行了
docker run --rm -it -v /usr/local/src/k8s.io/kubernetes:/go/src/k8s.io/kubernetes \
mirrorgooglecontainers/kube-cross:v1.12.10-1 bash
cd /go/src/k8s.io/kubernetes
make all WHAT=cmd/kubeadm GOFLAGS=-v
exit
成品位置
编译好的成品在: _output/local/bin/linux/amd64/kubeadm
成品测试
cp _output/local/bin/linux/amd64/kubeadm /usr/bin/
chmod a+x /usr/bin/kubeadm
kubeadm version
cd /usr/local/src
wget ftp://10.252.97.213/soft/kubeadm
cp /usr/bin/kubeadm /usr/bin/kubeadm_back
cp /usr/local/src/kubeadm /usr/bin/kubeadm
chmod 755 /usr/bin/kubeadm
cp -ra /etc/kubernetes /etc/kubernetes_back
kubeadm alpha certs check-expiration
kubeadm alpha certs renew all
[root@AiK8sM2 ~]# kubeadm alpha certs check-expiration
CERTIFICATE EXPIRES RESIDUAL TIME EXTERNALLY MANAGED
admin.conf Apr 03, 2120 06:46 UTC 99y no
apiserver Apr 03, 2120 09:36 UTC 99y no
apiserver-etcd-client Apr 03, 2120 09:36 UTC 99y no
apiserver-kubelet-client Apr 03, 2120 09:36 UTC 99y no
controller-manager.conf Apr 03, 2120 09:36 UTC 99y no
etcd-healthcheck-client Apr 03, 2120 09:36 UTC 99y no
etcd-peer Apr 03, 2120 09:36 UTC 99y no
etcd-server Apr 03, 2120 09:36 UTC 99y no
front-proxy-client Apr 03, 2120 06:47 UTC 99y no
scheduler.conf Apr 03, 2120 09:36 UTC 99y no
说明:主要为了重启proxy和etcd
service docker restart
service kubelet restart
cd /usr/local/src
wget ftp://10.252.97.213/soft/kubeadm
cp /usr/bin/kubeadm /usr/bin/kubeadm_back
cp /usr/local/src/kubeadm /usr/bin/kubeadm
chmod 755 /usr/bin/kubeadm
cp -ra /etc/kubernetes /etc/kubernetes_back
kubeadm alpha certs check-expiration
kubeadm alpha certs renew all
[root@AiK8sM2 ~]# kubeadm alpha certs check-expiration
CERTIFICATE EXPIRES RESIDUAL TIME EXTERNALLY MANAGED
admin.conf Apr 03, 2120 06:46 UTC 99y no
apiserver Apr 03, 2120 09:36 UTC 99y no
apiserver-etcd-client Apr 03, 2120 09:36 UTC 99y no
apiserver-kubelet-client Apr 03, 2120 09:36 UTC 99y no
controller-manager.conf Apr 03, 2120 09:36 UTC 99y no
etcd-healthcheck-client Apr 03, 2120 09:36 UTC 99y no
etcd-peer Apr 03, 2120 09:36 UTC 99y no
etcd-server Apr 03, 2120 09:36 UTC 99y no
front-proxy-client Apr 03, 2120 06:47 UTC 99y no
scheduler.conf Apr 03, 2120 09:36 UTC 99y no
ssh 10.251.137.187 "mkdir -p /etc/kubernetes/pki/etcd"
ssh 10.251.137.188 "mkdir -p /etc/kubernetes/pki/etcd"
scp -r /etc/kubernetes/admin.conf 10.251.137.187:/etc/kubernetes/admin.conf
scp -r /etc/kubernetes/admin.conf 10.251.137.188:/etc/kubernetes/admin.conf
scp -r /etc/kubernetes/pki/{ca.*,sa.*,front*} 10.251.137.187:/etc/kubernetes/pki/
scp -r /etc/kubernetes/pki/{ca.*,sa.*,front*} 10.251.137.188:/etc/kubernetes/pki/
scp -r /etc/kubernetes/pki/etcd/ca.* 10.251.137.187:/etc/kubernetes/pki/etcd/
scp -r /etc/kubernetes/pki/etcd/ca.* 10.251.137.188:/etc/kubernetes/pki/etcd/
说明:主要为了重启proxy和etcd
service docker restart
service kubelet restart