Installing Operators on minikube

Installing etcd Operator and Service Binding Operator on minikube

Installing Operators on minikube

This guide assumes that you are using minikube v1.11.0 or newer.

In this guide, we will discuss installing two Operators on a minikube environment:

  1. etcd Operator

  2. Service Binding Operator

Note

We will be updating our documentation with steps to install and work with more Operators in future.

Prerequisites

You must enable the olm addon for your minikube cluster by doing:

$ minikube addons enable olm

Installing etcd Operator

Operators can be installed in a specific namepsace or across the cluster (that is, for all the namespaces). We will install etcd Operator across the cluster such that if you create a new namespace, the etcd Operator will be automatically available for use.

To install an Operator, we need to make sure that the namespace in which we’re installing it has an OperatorGroup. Since we want to install etcd Operator across all the namespaces, we will install it in operators namespace and olm takes care of making it available across all the namespace.

Note

You can’t always install an Operator in the operators namespace and expect it to be available across all namespaces. The Operator you’re trying to installing needs to be designed to be available in this way as well. Certain Operators only support installation in a single namespace.

Discussing this topic is out of scope of this guide so we have stated it as a note.

Enabling the olm addon will, among other things, create an OperatorGroup in the operators namepsace. Make sure that it’s there:

$ kubectl get og -n operators
NAME               AGE
global-operators   3m37s

If you don’t see one, create it using below command:

$ kubectl create -f - << EOF
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
  name: global-operators
  namespace: operators
spec:
  targetNamespaces:
  - operators
EOF

Now, install the etcd Operator using below command:

$ kubectl create -f - << EOF
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: etcd
  namespace: operators
spec:
  channel: clusterwide-alpha
  name: etcd
  source: operatorhubio-catalog
  sourceNamespace: olm
  startingCSV: etcdoperator.v0.9.4-clusterwide
  installPlanApproval: Automatic
EOF

Give it a few seconds before checking the availability of the etcd Operator. odo lists only those Operators which are successfully installed on the cluster. If an Operator failed to install or is getting installed (that is, its status is Installing), odo won’t list it. This is to prevent accidental creation of service(s) from an Operator that is not yet availabe for use:

$ odo catalog list services
Operators available in the cluster
NAME                                CRDs
etcdoperator.v0.9.4-clusterwide     EtcdCluster, EtcdBackup, EtcdRestore

Troubleshooting

If you don’t see etcd Operator using above command or by doing kubectl get csv -n operators, make sure that pod belonging to the CatalogSource named operatorhubio-catalog is running:

$ kubectl get po -n olm | grep operatorhubio-catalog

If the state of this pod is CrashLoopBackOff or NodeAffinity, delete it so that Kubernetes will automatically spin up a new pod for the CatalogSource:

$ kubectl delete po -n olm <name-of-operatorhubio-catalog-pod>

Once the pod for this CatalogSource is up, wait a few seconds before trying to find the etcd Operator when you do odo catalog list services.

Installing the Service Binding Operator

Service Binding Operator is used by odo to provide odo link feature. Please refer this document to install it on both OpenShift and Kubernetes.