Operator Lifecycle Manager¶
The Operator Lifecycle Manager (OLM) provides a declarative way to install and upgrade operators and their dependencies.
You can install the Starboard operator from OperatorHub.io or ArtifactHUB by creating the OperatorGroup, which defines the operator's multitenancy, and Subscription that links everything together to run the operator's pod.
As an example, let's install the operator from the OperatorHub catalog in the starboard-system
namespace and
configure it to watch the default
namespaces:
- Install the Operator Lifecycle Manager:
or
curl -L https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.20.0/install.sh -o install.sh chmod +x install.sh ./install.sh v0.20.0
kubectl apply -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.20.0/crds.yaml kubectl apply -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.20.0/olm.yaml
- Create the namespace to install the operator in:
kubectl create ns starboard-system
- Create the OperatorGroup to select all namespaces:
cat << EOF | kubectl apply -f - apiVersion: operators.coreos.com/v1alpha2 kind: OperatorGroup metadata: name: starboard-operator namespace: starboard-system spec: targetNamespaces: [] EOF
- (Optional) Configure Starboard by creating the
starboard
ConfigMap and thestarboard
secret in thestarboard-system
namespace. For example, you can use Trivy in ClientServer mode or Khulnasoft Enterprise as an active vulnerability scanner. If you skip this step, the operator will ensure default Settings on startup:kubectl apply -f https://raw.githubusercontent.com/khulnasoft/starboard/v0.15.20/deploy/static/03-starboard-operator.config.yaml
- Install default OPA Rego policies used by the built-in configuration checker:
kubectl apply -f https://raw.githubusercontent.com/khulnasoft/starboard/v0.15.20/deploy/static/04-starboard-operator.policies.yaml
- Install the operator by creating the Subscription:
The operator will be installed in the
cat << EOF | kubectl apply -f - apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: starboard-operator namespace: starboard-system spec: channel: alpha name: starboard-operator source: operatorhubio-catalog sourceNamespace: olm installPlanApproval: Automatic config: env: - name: OPERATOR_EXCLUDE_NAMESPACES value: "kube-system,starboard-system" EOF
starboard-system
namespace and will select all namespaces, exceptkube-system
andstarboard-system
. Note that thespec.config
property allows you to override the default Configuration of the operator's Deployment. - After install, watch the operator come up using the following command:
If the above command succeeds and the ClusterServiceVersion has transitioned from
$ kubectl get clusterserviceversions -n starboard-system NAME DISPLAY VERSION REPLACES PHASE starboard-operator.v0.15.20 Starboard Operator 0.15.20 starboard-operator.v0.15.19 Succeeded
Installing
toSucceeded
phase you will also find the operator's Deployment in the same namespace where the Subscription is:If for some reason it's not ready yet, check the logs of the Deployment for errors:$ kubectl get deployments -n starboard-system NAME READY UP-TO-DATE AVAILABLE AGE starboard-operator 1/1 1 1 11m
kubectl logs deployment/starboard-operator -n starboard-system
Uninstall¶
To uninstall the operator delete the Subscription, the ClusterServiceVersion, and the OperatorGroup:
kubectl delete subscription starboard-operator -n starboard-system
kubectl delete clusterserviceversion starboard-operator.v0.15.20 -n starboard-system
kubectl delete operatorgroup starboard-operator -n starboard-system
kubectl delete ns starboard-system
You have to manually delete custom resource definitions created by the OLM operator:
Danger
Deleting custom resource definitions will also delete all security reports generated by the operator.
kubectl delete crd vulnerabilityreports.khulnasoft.github.io
kubectl delete crd configauditreports.khulnasoft.github.io
kubectl delete crd clusterconfigauditreports.khulnasoft.github.io
kubectl delete crd ciskubebenchreports.khulnasoft.github.io
kubectl delete crd clustercompliancereports.khulnasoft.github.io
kubectl delete crd clustercompliancedetailreports.khulnasoft.github.io