0条评论
还没有人评论过~
1 [root@master01 ~]# tree /etc/kubernetes/pki/ 2 [root@master01 ~]# for tls in `find /etc/kubernetes/pki -maxdepth 2 -name "*.crt"`; \ 3 do echo ===============$tls===============; \ 4 openssl x509 -in $tls -text| grep Not; \ 5 done
1 [root@master01 ~]# tree /etc/kubernetes/pki/
1 [root@master01 ~]# kubeadm alpha certs check-expiration
1 [root@master01 ~]# ll /etc/kubernetes/pki/ca* 2 -rw-r--r-- 1 root root 1.1K Jun 15 21:08 /etc/kubernetes/pki/ca.crt 3 -rw------- 1 root root 1.7K Jun 15 21:08 /etc/kubernetes/pki/ca.key
1 [root@master01 ~]# ll /etc/kubernetes/pki/apiserver.* 2 -rw-r--r-- 1 root root 1.3K Jun 15 21:08 /etc/kubernetes/pki/apiserver.crt 3 -rw------- 1 root root 1.7K Jun 15 21:08 /etc/kubernetes/pki/apiserver.key
1 [root@master01 ~]# ll /etc/kubernetes/pki/apiserver-kubelet-client.* 2 -rw-r--r-- 1 root root 1.1K Jun 15 21:08 /etc/kubernetes/pki/apiserver-kubelet-client.crt 3 -rw------- 1 root root 1.7K Jun 15 21:08 /etc/kubernetes/pki/apiserver-kubelet-client.key
1 [root@master01 ~]# ll /etc/kubernetes/pki/front-proxy-ca.* 2 -rw-r--r-- 1 root root 1.1K Jun 15 21:08 /etc/kubernetes/pki/front-proxy-ca.crt 3 -rw------- 1 root root 1.7K Jun 15 21:08 /etc/kubernetes/pki/front-proxy-ca.key
1 [root@master01 ~]# ll /etc/kubernetes/pki/front-proxy-client.* 2 -rw-r--r-- 1 root root 1.1K Jun 15 21:08 /etc/kubernetes/pki/front-proxy-client.crt 3 -rw------- 1 root root 1.7K Jun 15 21:08 /etc/kubernetes/pki/front-proxy-client.key 4
1 [root@master01 ~]# ll /etc/kubernetes/pki/etcd/ca.* 2 -rw-r--r-- 1 root root 1017 Jun 15 21:08 /etc/kubernetes/pki/etcd/ca.crt 3 -rw------- 1 root root 1.7K Jun 15 21:08 /etc/kubernetes/pki/etcd/ca.key 4
1 [root@master01 ~]# ll /etc/kubernetes/pki/etcd/server.* 2 -rw-r--r-- 1 root root 1.2K Jun 15 21:08 /etc/kubernetes/pki/etcd/server.crt 3 -rw------- 1 root root 1.7K Jun 15 21:08 /etc/kubernetes/pki/etcd/server.key 4
1 [root@master01 ~]# ll /etc/kubernetes/pki/etcd/peer.* 2 -rw-r--r-- 1 root root 1.2K Jun 15 21:08 /etc/kubernetes/pki/etcd/peer.crt 3 -rw------- 1 root root 1.7K Jun 15 21:08 /etc/kubernetes/pki/etcd/peer.key 4
1 [root@master01 ~]# ll /etc/kubernetes/pki/etcd/healthcheck-client.* 2 -rw-r--r-- 1 root root 1.1K Jun 15 21:08 /etc/kubernetes/pki/etcd/healthcheck-client.crt 3 -rw------- 1 root root 1.7K Jun 15 21:08 /etc/kubernetes/pki/etcd/healthcheck-client.key 4
1 [root@master01 ~]# ll /etc/kubernetes/pki/apiserver-etcd-client.* 2 -rw-r--r-- 1 root root 1.1K Jun 15 21:08 /etc/kubernetes/pki/apiserver-etcd-client.crt 3 -rw------- 1 root root 1.7K Jun 15 21:08 /etc/kubernetes/pki/apiserver-etcd-client.key 4
1 [root@master01 ~]# ll /etc/kubernetes/pki/sa.* 2 -rw------- 1 root root 1.7K Jun 15 21:08 /etc/kubernetes/pki/sa.key 3 -rw------- 1 root root 451 Jun 15 21:08 /etc/kubernetes/pki/sa.pub 4
1 [root@master01 ~]# kubeadm config view > kubeadm-cluster.yaml
1 [root@master01 ~]# kubeadm alpha certs renew --help #查看帮助
1 [root@master01 ~]# kubeadm alpha certs renew all --config=kubeadm-cluster.yaml #更新所有证书
1 [root@master01 ~]# kubeadm alpha certs check-expiration #确认验证
1 [root@master01 ~]# scp -rp kubeadm-cluster.yaml root@master02:/root/ 2 [root@master01 ~]# scp -rp kubeadm-cluster.yaml root@master03:/root/ 3 [root@master02 ~]# kubeadm alpha certs renew all --config=kubeadm-cluster.yaml 4 [root@master03 ~]# kubeadm alpha certs renew all --config=kubeadm-cluster.yaml 5
1 [root@master01 ~]# docker ps |grep -E 'k8s_kube-apiserver|k8s_kube-controller-manager|k8s_kube-scheduler|k8s_etcd_etcd' | awk -F ' ' '{print $1}' |xargs docker restart 2 [root@master02 ~]# docker ps |grep -E 'k8s_kube-apiserver|k8s_kube-controller-manager|k8s_kube-scheduler|k8s_etcd_etcd' | awk -F ' ' '{print $1}' |xargs docker restart 3 [root@master03 ~]# docker ps |grep -E 'k8s_kube-apiserver|k8s_kube-controller-manager|k8s_kube-scheduler|k8s_etcd_etcd' | awk -F ' ' '{print $1}' |xargs docker restart
1 [root@master01 ~]# kubeadm config view > kubeadm-cluster.yaml
1 [root@master01 ~]# kubectl version
1 [root@master01 ~]# wget https://github.com/kubernetes/kubernetes/archive/v1.18.3.tar.gz 2 [root@master01 ~]# tar -zxvf v1.18.3.tar.gz 3
1 [root@master01 ~]# vi kubernetes-1.18.3/staging/src/k8s.io/client-go/util/cert/cert.go 2 …… 3 57 func NewSelfSignedCACert(cfg Config, key crypto.Signer) (*x509.Certificate, error) { 4 …… 5 65 NotBefore: now.UTC(), 6 66 NotAfter: now.Add(duration365d * 100).UTC(), 7 ……
1 [root@master01 ~]# vi kubernetes-1.18.3/cmd/kubeadm/app/constants/constants.go 2 …… 3 39 const ( 4 48 // CertificateValidity defines the validity for all the signed certificates generated by kubeadm 5 49 CertificateValidity = time.Hour * 24 * 365 * 100 6 …… 7 [root@master01 kubernetes-1.18.3]# cat build/build-image/cross/VERSION 8 v1.13.9-5 #使用官方corss版本
1 [root@master01 kubernetes-1.18.3]# docker pull us.gcr.io/k8s-artifacts-prod/build-image/kube-cross:v1.13.9-5 2 [root@master01 ~]# docker run --rm -v /root/kubernetes-1.18.3/:/go/src/k8s.io/kubernetes -it us.gcr.io/k8s-artifacts-prod/build-image/kube-cross:v1.13.9-5 bash 3 root@51e96585ea73:/go# cd /go/src/k8s.io/kubernetes 4 root@51e96585ea73:/go/src/k8s.io/kubernetes# make all WHAT=cmd/kubeadm GOFLAGS=-v
1 root@51e96585ea73:/go/src/k8s.io/kubernetes# exit #退出容器 2 [root@master01 ~]# mv /usr/bin/kubeadm /usr/bin/kubeadm_backup #备份原kubeadm 3 [root@master01 ~]# cp kubernetes-1.18.3/_output/local/bin/linux/amd64/kubeadm /usr/bin/kubeadm 4 [root@master01 ~]# kubeadm version #查看版本 5
1 [root@master01 ~]# yum -y install gcc make rsync jq 2 [root@master01 ~]# wget https://dl.google.com/go/go1.13.9.linux-amd64.tar.gz 3 [root@master01 ~]# tar zxvf go1.13.9.linux-amd64.tar.gz -C /usr/local/ 4 [root@master01 ~]# vi /etc/profile.d/goenv.sh 5 #go setting 6 export GOROOT=/usr/local/go 7 export GOPATH=/usr/local/gopath 8 export PATH=$PATH:$GOROOT/bin 9 [root@master01 ~]# source /etc/profile 10 [root@master01 ~]# go version 11 go version go1.13.9 linux/amd64 12 [root@master01 ~]# cd kubernetes-1.18.3/ 13 [root@master01 kubernetes-1.18.3]# make all WHAT=cmd/kubeadm GOFLAGS=-v 14 [root@master01 kubernetes-1.18.3]# mv /usr/bin/kubeadm /usr/bin/kubeadm_backup #备份原kubeadm 15 [root@master01 kubernetes-1.18.3]# cp _output/local/bin/linux/amd64/kubeadm /usr/bin/kubeadm
1 [root@master01 ~]# kubeadm config view > kubeadm-cluster.yaml
1 [root@master01 ~]# ssh root@master02 "mv /usr/bin/kubeadm /usr/bin/kubeadm_backup" 2 [root@master01 ~]# ssh root@master03 "mv /usr/bin/kubeadm /usr/bin/kubeadm_backup" 3 [root@master01 ~]# scp -rp kubeadm-cluster.yaml root@master02:/root/ 4 [root@master01 ~]# scp -rp kubeadm-cluster.yaml root@master03:/root/ 5 [root@master01 ~]# kubeadm alpha certs renew all --config=kubeadm-cluster.yaml 6 [root@master02 ~]# kubeadm alpha certs renew all --config=kubeadm-cluster.yaml 7 [root@master03 ~]# kubeadm alpha certs renew all --config=kubeadm-cluster.yaml 8 [root@master01 ~]# kubeadm alpha certs check-expiration #确认验证