可以选择源码安装和二进制文件安装
git clone https://github.com/operator-framework/operator-sdk
cd operator-sdk
git checkout master
make install
编译成功后命令operator-sdk将被安装到 $GOPATH/bin目录下,需要将该目录配置到系统的 $PATH中。
配置目标服务器的相关的环境变量
export ARCH=$(case $(uname -m) in x86_64) echo -n amd64 ;; aarch64) echo -n arm64 ;; *) echo -n $(uname -m) ;; esac)
export OS=$(uname | awk '{print tolower($0)}')
export ARCH=$(case $(uname -m) in x86_64) echo -n amd64 ;; aarch64) echo -n arm64 ;; *) echo -n $(uname -m) ;; esac)
export OS=$(uname | awk '{print tolower($0)}')
下载与目标服务器相配的二进制文件
export OPERATOR_SDK_DL_URL=https://github.com/operator-framework/operator-sdk/releases/download/v1.9.0
curl -LO ${OPERATOR_SDK_DL_URL}/operator-sdk_${OS}_${ARCH}
安装
chmod +x operator-sdk_${OS}_${ARCH} && sudo mv operator-sdk_${OS}_${ARCH} /usr/local/bin/operator-sdk
执行
operator-sdk version
operator-sdk version: "v1.9.0-6-g2781cf89", commit: "2781cf89a0d51a2783fa979a50ce8fdb22c820a9", kubernetes version: "v1.20.2", go version: "go1.16.5", GOOS: "linux", GOARCH: "amd64"