Installing the Compliance Operator using the CLI
You can install the Compliance Operator by using the OpenShift CLI by creating the required namespace, Operator group, and subscription objects.
-
You must have
adminprivileges. -
You must have a
StorageClassresource configured.
-
Define a
Namespaceobject:Examplenamespace-object.yamlapiVersion: v1 kind: Namespace metadata: labels: openshift.io/cluster-monitoring: "true" pod-security.kubernetes.io/enforce: privileged name: openshift-compliancewhere:
metadata.labels.pod-security.kubernetes.io/enforce-
Specifies the pod security label that must be set to
privilegedat the namespace level in Red Hat OpenShift Container Platform {product-version}.
-
Create the
Namespaceobject:$ oc create -f namespace-object.yaml -
Define an
OperatorGroupobject:Exampleoperator-group-object.yamlapiVersion: operators.coreos.com/v1 kind: OperatorGroup metadata: name: compliance-operator namespace: openshift-compliance spec: targetNamespaces: - openshift-compliance -
Create the
OperatorGroupobject:$ oc create -f operator-group-object.yaml -
Define a
Subscriptionobject:Examplesubscription-object.yamlapiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: compliance-operator-sub namespace: openshift-compliance spec: channel: "stable" installPlanApproval: Automatic name: compliance-operator source: redhat-operators sourceNamespace: openshift-marketplace -
Create the
Subscriptionobject:$ oc create -f subscription-object.yamlIf you are setting the global scheduler feature and enable
defaultNodeSelector, you must create the namespace manually and update the annotations of theopenshift-compliancenamespace, or the namespace where the Compliance Operator was installed, withopenshift.io/node-selector: “”. This removes the default node selector and prevents deployment failures.
-
Verify the installation succeeded by inspecting the CSV file:
$ oc get csv -n openshift-compliance -
Verify that the Compliance Operator is up and running:
$ oc get deploy -n openshift-compliance