<aside> 💡 *系统版本:CentOS 7.7

kubeadm 版本:1.15.1

go版本:go1.12.9*

</aside>

一、安装go环境

wget <https://golang.google.cn/dl/go1.12.9.linux-amd64.tar.gz>
tar -xf go1.12.9.linux-amd64.tar.gz -C /usr/local/
echo  'export PATH=$PATH:/usr/local/go/bin' >> /etc/profile
source /etc/profile
go version

二、下载源码

git clone <https://github.com/kubernetes/kubernetes.git>
cd kubernetes
git checkout -b remotes/origin/release-1.15.1 v1.15.1

三、修改源码

vim cmd/kubeadm/app/util/pkiutil/pki_helpers.go

修改NewSignedCert方法

const duration365d = time.Hour * 24 * 356 * 10
NotAfter:     time.Now().Add(kubeadmconstants.CertificateValidity).UTC()
NotAfter:     time.Now().Add(duration365d).UTC()

四、编译

make WHAT=cmd/kubeadm GOFLAGS=-v

五、替换kubeadm

cp -r /etc/kubernetes/pki /etc/kubernetes/pkibak