Managing Operators Flashcards
Check the list of available operators
oc get packagemanifests
Inspect an operator
oc describe packagemanifests file-integrity-operator
Get an operator version
oc get packagemanifests file-integrity-operator
–output=’jsonpath={range .status.channels[*]}{.name}{“\n”}{end}’
get list of installed operators across namespaces
oc get csv -A
list the operators managed by the OLM
oc get subs -A
Namespace CR for operator creation
Operators that are installed using the OLM require a group that matches the namespace name. True or False?
True
CR to create a group for the operator
CR to create an operator sub
Steps to create an operator
1) Create namespace with: openshift.io/cluster-monitoring: “true”
2) Create an operator group
3) Create a subscription object
Check the logs of the OLM pod to verify operator installation
oc logs pod/olm-operator-c5599dfd7-nknfx \
-n openshift-operator-lifecycle-manager
Inspect the subscription object to verify the operator status
oc describe sub <subscription-name> -n <namespace></namespace></subscription-name>
Deleting Operator
1) oc delete sub <subscription-name>
2) oc get sub <subscription-name> -o yaml | grep currentCSV
3) oc delete csv <currentCSV></currentCSV></subscription-name></subscription-name>
view events and logs of an operator
oc logs deployment.apps/file-integrity-operator
get all objects related to an operator
oc get all -n openshift-file-integrity
view the status and events from custom resources related to a given operator
1) oc describe deployment.apps/file-integrity-operator | \
grep -i kind
2) oc get crd | grep -i fileintegrity
list the cluster operators and their status
oc get clusteroperator
Extract the release of a cluster operator
1) VER=”$(oc get clusterversion version -o jsonpath=’{.status.desired.image}’)”
2) oc adm release extract –from=$VER –to=release-image
3) less release-image/samples06-operator.yaml
List the Cluster Samples Operator pods
oc get pods -n openshift-cluster-samples-operator
View logs for the Cluster Samples Operator pods.
oc logs pod/cluster-samples-operator-5d7d5b94b6-rw284 -n openshift-cluster-samples-operator –all-containers