Operator SDK 的安装支持多种方式,包括:

  • Homebrew(macOS)
  • GitHub Release 下载
  • 源码编码安装

下面,我们来依次进行说明。

Homebrew安装

homebrew 的安装非常简单:

  1. brew install operator-sdk

Github Release下载

  1. # 下载
  2. # 设置平台版本
  3. export ARCH=$(case $(uname -m) in x86_64) echo -n amd64 ;; aarch64) echo -n arm64 ;; *) echo -n $(uname -m) ;; esac)
  4. export OS=$(uname | awk '{print tolower($0)}')
  5. # 下载
  6. export OPERATOR_SDK_DL_URL=https://github.com/operator-framework/operator-sdk/releases/download/v1.14.0
  7. curl -LO ${OPERATOR_SDK_DL_URL}/operator-sdk_${OS}_${ARCH}
  8. # 安装
  9. chmod +x operator-sdk_${OS}_${ARCH} && sudo mv operator-sdk_${OS}_${ARCH} /usr/local/bin/operator-sdk

源码编译(推荐)

  1. git clone https://github.com/operator-framework/operator-sdk
  2. cd operator-sdk
  3. git checkout v0.16.0 # kubernetes-1.16.3
  4. make install