本文将向您展示如何轻松地在Linux/macOS上安装最新版本的Operator SDK CLI,以便您准备开始构建自己的Operators。Operator构架是一个开放源代码工具包,旨在以有效、自动化和可扩展的方式管理Kubernetes(安装参考:Ubuntu 18.04下安装Kubernetes 1.11 + Istio 1.0组合)本地应用程序(Operators),运营商可以利用Kubernetes的可扩展性来提供云服务的自动化优势,例如供应、扩展、备份和还原,同时在Kubernetes可以运行的任何位置运行。Operator SDK具有一个CLI工具,供开发人员和群集管理员在创建、构建和部署新的Operator项目时使用。
在Linux/macOS上安装Operator SDK CLI 您应该先下载该应用程序的最新可用版本,我们使用curl命令行直接从Github API查询最新版本。 在Linux上下载发行版二进制文件: curl -s https://api.github.com/repos/operator-framework/operator-sdk/releases/latest | grep browser_download_url | grep x86_64-linux-gnu | cut -d '"' -f 4 | wget -i - 在macOS上下载发行版二进制文件: curl -s https://api.github.com/repos/operator-framework/operator-sdk/releases/latest | grep browser_download_url | grep x86_64-apple-darwin | cut -d '"' -f 4 | wget -i - 下载文件后,请使用提供的ASC文件验证下载的发行二进制文件。 针对Linux系统: $ gpg --verify operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu.asc 针对macOS系统: $ gpg --verify operator-sdk-*-x86_64-apple-darwin.asc 如果您的计算机上没有维护人员的公钥,则会显示以下错误: gpg: directory '/var/home/jkmutai/.gnupg' created gpg: keybox '/var/home/jkmutai/.gnupg/pubring.kbx' created gpg: assuming signed data in 'operator-sdk-v0.16.0-x86_64-apple-darwin' gpg: Signature made Tue 17 Mar 2020 09:47:38 PM EAT gpg: using RSA key 7CC439CD21EE1031C3831C6590354A3F09FCE996 gpg: Can't check signature: No public key 使用以下命令下载密钥,将“<key_id>”替换为上一个输出中提供的RSA密钥字符串: $ gpg --recv-key "<key_id>" 对我来说,这将是: $ gpg --recv-key 7CC439CD21EE1031C3831C6590354A3F09FCE996 gpg: /var/home/jkmutai/.gnupg/trustdb.gpg: trustdb created gpg: key 90354A3F09FCE996: public key "Varsha Prasad Narsing (RedHat office purpose) <vnarsing@redhat.com>" imported gpg: Total number processed: 1 gpg: imported: 1 现在您应该能够验证二进制文件了: $ gpg --verify operator-sdk-*-x86_64-apple-darwin.asc gpg: assuming signed data in 'operator-sdk-v0.16.0-x86_64-apple-darwin' gpg: Signature made Tue 17 Mar 2020 09:47:38 PM EAT gpg: using RSA key 7CC439CD21EE1031C3831C6590354A3F09FCE996 gpg: Good signature from "Varsha Prasad Narsing (RedHat office purpose) <vnarsing@redhat.com>" [unknown] gpg: WARNING: This key is not certified with a trusted signature! gpg: There is no indication that the signature belongs to the owner. Primary key fingerprint: 7CC4 39CD 21EE 1031 C383 1C65 9035 4A3F 09FC E996 将二进制文件移动到/usr/local/bin目录。 针对Linux系统: sudo mv operator-sdk-*-x86_64-linux-gnu /usr/local/bin/operator-sdk rm -rf operator-sdk* 针对macOS系统: sudo mv operator-sdk-*-x86_64-apple-darwin /usr/local/bin/operator-sdk rm -rf operator-sdk* 验证CLI工具是否已正确安装: $ operator-sdk version operator-sdk version: "v0.16.0-dirty", commit: "55f1446c5f472e7d8e308dcdf36d0d7fc44fc4fd", go version: "go1.13.8 linux/amd64" 至此,安装Operator SDK CLI完成。
相关主题 |