天天看点

k8s operator开发脚手架kubebuilder 3.2.0安装脚本整理

执行下面两行命令即可完成安装

wget https://github.com/kubernetes-sigs/kubebuilder/releases/download/v3.2.0/kubebuilder_linux_amd64 -O /D/Softwares-Linux/kubebuilder-v3.2.0_linux_amd64

sudo ln -s /D/Softwares-Linux/kubebuilder-v3.2.0_linux_amd64 /usr/local/bin/kubebuilder      

测试过程

# 下载地址
# https://github.com/kubernetes-sigs/kubebuilder/tags

# v3.2.0 it is work!
wget https://github.com/kubernetes-sigs/kubebuilder/releases/download/v3.2.0/kubebuilder_linux_amd64 -O /D/Softwares-Linux/kubebuilder-v3.2.0_linux_amd64
sudo ln -s /D/Softwares-Linux/kubebuilder-v3.2.0_linux_amd64 /usr/local/bin/kubebuilder

# latest 
# 报错:failed to initialize project: unable to scaffold with "base.go.kubebuilder.io/v3": exit status 2
# curl -L -o /D/Softwares-Linux/kubebuilder_latest https://go.kubebuilder.io/dl/latest/$(go env GOOS)/$(go env GOARCH)
# sudo chmod +x /D/Softwares-Linux/kubebuilder_latest && sudo ln -s /D/Softwares-Linux/kubebuilder_latest /usr/local/bin/kubebuilder

# v2.3.1 it is work!
# wget https://github.com/kubernetes-sigs/kubebuilder/releases/download/v2.3.1/kubebuilder_2.3.1_linux_amd64.tar.gz -O /D/Softwares-Linux/kubebuilder_2.3.1_linux_amd64.tar.gz
# tar zxf /D/Softwares-Linux/kubebuilder_2.3.1_linux_amd64.tar.gz -C /D/Softwares-Linux/
# sudo ln -s /D/Softwares-Linux/kubebuilder_2.3.1_linux_amd64/bin/kubebuilder /usr/local/bin/kubebuilder

# 下面的命令执行报错,改用直接在github下载gz包的方式进行安装
# os=$(go env GOOS)
# arch=$(go env GOARCH)

# 下载 kubebuilder 并解压到 tmp 目录中
# curl -L https://go.kubebuilder.io/dl/3.3.0/${os}/${arch} | tar -xz -C /D/Softwares-Linux
# curl -L https://go.kubebuilder.io/dl/2.3.1/${os}/${arch} | tar -xz -C /D/Softwares-Linux      

参考链接:

​​

​​​​