七叶笔记 » golang编程 » 树莓派centos-arm安装k8s编译

树莓派centos-arm安装k8s编译

本文演示如何在centos-arm系统上进行编译k8s

1.安装k8s的安装环境:golang

# wget -c -P /opt/package/

wget -P /opt/package/

cd /opt/package/

ls

tar -C /opt/software/ -xzf go1.11.4.linux-arm64.tar.gz

cd /opt/software/

echo “export PATH=$PATH:/opt/software/go/bin” >> /etc/profile && source /etc/profile

2.下载k8s的源码包

cd /opt/package/

git clone kubernetes -b release-1.13

如果下载慢,请按照下面链接进行配置:

3.编译

3.1 修改编译的架构体系,减少不必要环境的编译

进入 kubernates目录,编译 /kubernate/hack/lib/golang.sh ,将

KUBE_SUPPORTED_SERVER_PLATFORMS、KUBE_SUPPORTED_NODE_PLATFORMS、 KUBE_SUPPORTED_CLIENT_PLATFORMS 三个值中的其他环境注释掉

三个值中不需要进行编译的环境注释掉

4.开始编译

cd /opt/software/source/kubernetes

#KUBE_BUILD_PLATFORMS= linux /arm64 make all

KUBE_BUILD_PLATFORMS=linux/arm64 make all WHAT=cmd/kubelet GOFLAGS=-v GOGCFLAGS=”-N -l” GOPATH=”/opt/software/go/bin”

#cd k8s. io /kubernates/cmd/kubelet

#go build kubelet.go -v

cd /opt/package/source/k8s/kubernetes/_output/local/go/bin/linux_arm64

5.编译成功后,进入cd k8s.io /kubernates/cmd/kubelet 找到对应文件,说明编译成功

参考链接:

相关文章