To follow the steps in this learning path for developing Golang-based operators, you need to install the following software on your machine. Environment-specific installation instructions for installing Operator SDK and the oc or kubectl CLIs and for provisioning a cluster are below.
Prerequisites for installing Operator SDK on a macOS
Note: The tutorials in this series work with Go v1.15 and Operator SDK v1.5.0.
To develop Golang-based operators on macOS, you need to install the following:
OpenShift CLI (If you plan to deploy to OpenShift cluster) oc
To use an OpenShift cluster, we recommend using version 4.6+.
Additionally, you need:
Access to a Kubernetes v1.11.3+ cluster (v1.16.0+ if using apiextensions.k8s.io/v1 CRDs). See minikube or CodeReady Containers to access a free cluster.
Cluster admin permission. See how to grant yourself cluster-admin privileges or be logged in as admin.
OpenShift CLI (If you plan to deploy to OpenShift Cluster) oc
To use an OpenShift cluster, we recommend you use version 4.6+
Additionally, you need:
Access to a Kubernetes v1.11.3+ cluster (v1.16.0+ if using apiextensions.k8s.io/v1 CRDs). See minikube or CodeReady Containers to access a cluster for free.
Install Operator SDK (version 1.5+) with Go (version 1.15.5) for macOS
Normally, to install the Operator SDK with Homebrew, you would run brew install operator-sdk. This installs the latest version of the Operator SDK with the latest version of Go. However, the Operator SDK (as of v1.5) does not work with the latest version of Go (v1.16+). To follow these tutorials, you need to explicitly install the versions that are used in these tutorials: Go v1.15 and Operator SDK v1.5.0
(If you haven't already) provision an OpenShift cluster by going to https://cloud.ibm.com/ and clicking Red Hat OpenShift on IBM Cloud tile. From there, you can select an OpenShift cluster of your choosing.
We recommend you use an OpenShift cluster of version 4.6 or higher.
After the cluster finishes provisioning, you should get a message that the Worker nodes are 100% normal, and the Master status is ready, as the picture below shows.
Provisioning an OpenShift cluster takes some time, so do so now if you don't have one already. Skip down to
the prepare your OpenShift Cluster step to see how to create an OpenShift cluster on IBM Cloud.
Ensure OpenShift Lifecycle Manager (OLM) is updated
To make sure your OpenShift Lifecycle Manager is
up to date and running properly, run the operator-sdk olm status command:
As you can see from this output above, all of the components of the OLM are in the Installed status which means your Operator Lifecycle Manager is working properly.
Note: If you see an error, you can read the SDK guide to learn how to install OLM on your cluster.
(Optional) Troubleshooting OLM error
If you get an error similar to the following two, you need to uninstall a specific version
Error 1
$ operator-sdk olm status
FATA[0002] Failed to get OLM status: error getting installed OLM version (set --version to override the default version): no existing installation found
Show more
Error 2
$ operator-sdk olm status
FATA[0002] Failed to get OLM status: error getting installed OLM version (set --version to override the default version): no existing installation found
$ operator-sdk olm install
FATA[0005] Failed to install OLM version "latest": detected existing OLM resources: OLM must be completely uninstalled before installation
$ operator-sdk olm uninstall
FATA[0002] Failed to uninstall OLM: error getting installed OLM version (set --version to override the default version): no existing installation found
Show more
These errors indicate the need to uninstall a specific version. My OpenShift cluster is version 4.5.31_1531, so I had to uninstall version 0.16.1 using the following command.
About cookies on this siteOur websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising.For more information, please review your cookie preferences options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.