×

The Operator SDK provides a command-line interface (CLI) tool that Operator developers can use to build, test, and deploy an Operator. You can install the Operator SDK CLI on your workstation so that you are prepared to start authoring your own Operators.

OKD 4.6 supports Operator SDK v0.19.4, which can be installed from upstream sources.

Starting in OKD 4.7, the Operator SDK is fully supported and available from official Red Hat product sources. See OKD 4.7 release notes for more information.

Installing the Operator SDK CLI from from GitHub releases

You can download and install a pre-built release binary of the Operator SDK CLI from the project on GitHub.

Prerequisites
  • Go v1.13+

  • docker v17.03+, podman v1.2.0+, or buildah v1.7+

  • OpenShift CLI (oc) v4.6+ installed

  • Access to a cluster based on Kubernetes v1.12.0+

  • Access to a container registry

Procedure
  1. Set the release version variable:

    $ RELEASE_VERSION=v0.19.4
  2. Download the release binary.

    • For Linux:

      $ curl -OJL https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu
    • For macOS:

      $ curl -OJL https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/operator-sdk-${RELEASE_VERSION}-x86_64-apple-darwin
  3. Verify the downloaded release binary.

    1. Download the provided .asc file.

      • For Linux:

        $ curl -OJL https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu.asc
      • For macOS:

        $ curl -OJL https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/operator-sdk-${RELEASE_VERSION}-x86_64-apple-darwin.asc
    2. Place the binary and corresponding .asc file into the same directory and run the following command to verify the binary:

      • For Linux:

        $ gpg --verify operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu.asc
      • For macOS:

        $ gpg --verify operator-sdk-${RELEASE_VERSION}-x86_64-apple-darwin.asc

      If you do not have the public key of the maintainer on your workstation, you will get the following error:

      Example output with error
      $ gpg: assuming signed data in 'operator-sdk-${RELEASE_VERSION}-x86_64-apple-darwin'
      $ gpg: Signature made Fri Apr  5 20:03:22 2019 CEST
      $ gpg:                using RSA key <key_id> (1)
      $ gpg: Can't check signature: No public key
      1 RSA key string.

      To download the key, run the following command, replacing <key_id> with the RSA key string provided in the output of the previous command:

      $ gpg [--keyserver keys.gnupg.net] --recv-key "<key_id>" (1)
      1 If you do not have a key server configured, specify one with the --keyserver option.
  4. Install the release binary in your PATH:

    • For Linux:

      $ chmod +x operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu
      $ sudo cp operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu /usr/local/bin/operator-sdk
      $ rm operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu
    • For macOS:

      $ chmod +x operator-sdk-${RELEASE_VERSION}-x86_64-apple-darwin
      $ sudo cp operator-sdk-${RELEASE_VERSION}-x86_64-apple-darwin /usr/local/bin/operator-sdk
      $ rm operator-sdk-${RELEASE_VERSION}-x86_64-apple-darwin
  5. Verify that the CLI tool was installed correctly:

    $ operator-sdk version

Installing the Operator SDK CLI from Homebrew

You can install the SDK CLI using Homebrew.

Prerequisites
  • Homebrew

  • docker v17.03+, podman v1.2.0+, or buildah v1.7+

  • OpenShift CLI (oc) v4.6+ installed

  • Access to a cluster based on Kubernetes v1.12.0+

  • Access to a container registry

Procedure
  1. Install the SDK CLI using the brew command:

    $ brew install operator-sdk
  2. Verify that the CLI tool was installed correctly:

    $ operator-sdk version

Compiling and installing the Operator SDK CLI from source

You can obtain the Operator SDK source code to compile and install the SDK CLI.

Prerequisites
  • Git

  • Go v1.13+

  • docker v17.03+, podman v1.2.0+, or buildah v1.7+

  • OpenShift CLI (oc) v4.6+ installed

  • Access to a cluster based on Kubernetes v1.12.0+

  • Access to a container registry

Procedure
  1. Clone the operator-sdk repository:

    $ git clone https://github.com/operator-framework/operator-sdk
  2. Change to the directory for the cloned repository:

    $ cd operator-sdk
  3. Check out the v0.19.4 release:

    $ git checkout tags/v0.19.4 -b v0.19.4
  4. Update dependencies:

    $ make tidy
  5. Compile and install the SDK CLI:

    $ make install

    This installs the CLI binary operator-sdk in the $GOPATH/bin/ directory.

  6. Verify that the CLI tool was installed correctly:

    $ operator-sdk version