安装Operator-SDK
从GitHub版本安装
从主编译并安装
下载安装程序
从GitHub版本安装
下载发行版二进制文件
设置平台信息:
export ARCH=$(case $(arch) in x86_64) echo -n amd64 ;; aarch64) echo -n arm64 ;; *) echo -n $(arch) ;; esac)
export OS=$(uname | awk '{print tolower($0)}')
下载适合您平台的二进制文件:
export OPERATOR_SDK_DL_URL=https://github.com/operator-framework/operator-sdk/releases/latest/download
curl -LO ${OPERATOR_SDK_DL_URL}/operator-sdk_${OS}_${ARCH}
2.验证下载的二进制文件
导入operator-sdk发布GPG密钥:
gpg --recv-keys 052996E2A20B5C7E
下载校验和文件及其签名,然后验证签名:
curl -LO ${OPERATOR_SDK_DL_URL}/checksums.txt
curl -LO ${OPERATOR_SDK_DL_URL}/checksums.txt.asc
gpg -u "Operator SDK (release) <cncf-operator-sdk@cncf.io>" --verify checksums.txt.asc
您应该看到类似于以下内容:
gpg: assuming signed data in 'checksums.txt'
gpg: Signature made Fri 30 Oct 2020 12:15:15 PM PDT
gpg: using RSA key ADE83605E945FA5A1BD8639C59E5B47624962185
gpg: Good signature from "Operator SDK (release) <cncf-operator-sdk@cncf.io>" [ultimate]
确保校验和匹配:
grep operator-sdk_${OS}_${ARCH} checksums.txt | sha256sum -c -
您应该看到类似于以下内容:
operator-sdk_linux_amd64: OK
3.在您的PATH中安装发行版二进制文件
chmod +x operator-sdk_${OS}_${ARCH} && sudo mv operator-sdk_${OS}_${ARCH} /usr/local/bin/operator-sdk
或者直接下载二进制文件
wget https://github.com/operator-framework/operator-sdk/releases/download/v1.3.0/operator-sdk_linux_amd64
chmod +x operator-sdk_linux_amd64
mv operator-sdk_linux_amd64 /usr/local/bin/operator-sdk
从主编译并安装
预先要求
dep version v0.5.0+.
git
go version v1.10+.
docker version 17.03+.
kubectl version v1.11.0+.
Access to a kubernetes v.1.11.0+ cluster.
快速开始
首先, 检出和安装 operator-sdk CLI,如下:
$ mkdir -p $GOPATH/src/github.com/operator-framework
$ cd $GOPATH/src/github.com/operator-framework
$ git clone https://github.com/operator-framework/operator-sdk
$ cd operator-sdk
$ git checkout master
$ make dep
$ make install
$ operator-sdk version
operator-sdk version: "v1.3.0", commit: "1abf57985b43bf6a59dcd18147b3c574fa57d3f6", kubernetes version: "1.19.4", go version: "go1.15.5", GOOS: "linux", GOARCH: "amd64"