Installing the Security Profiles Operator using the CLI

You can install the Red Hat OpenShift Container Platform Security Profiles Operator by using the command line interface.

Prerequisites
  • You must have cluster-admin privileges.

Procedure
  1. Define a Namespace object:

    Example namespace-object.yaml
    apiVersion: v1
    kind: Namespace
    metadata:
        name: openshift-security-profiles
    labels:
      openshift.io/cluster-monitoring: "true"
  2. Create the Namespace object:

    $ oc create -f namespace-object.yaml
  3. Define an OperatorGroup object:

    Example operator-group-object.yaml
    apiVersion: operators.coreos.com/v1
    kind: OperatorGroup
    metadata:
      name: security-profiles-operator
      namespace: openshift-security-profiles
  4. Create the OperatorGroup object:

    $ oc create -f operator-group-object.yaml
  5. Define a Subscription object:

    Example subscription-object.yaml
    apiVersion: operators.coreos.com/v1alpha1
    kind: Subscription
    metadata:
      name: security-profiles-operator-sub
      namespace: openshift-security-profiles
    spec:
      channel: release-alpha-rhel-8
      installPlanApproval: Automatic
      name: security-profiles-operator
      source: redhat-operators
      sourceNamespace: openshift-marketplace
  6. Create the Subscription object:

    $ oc create -f subscription-object.yaml
    Note

    If you are setting the global scheduler feature and enable defaultNodeSelector, you must create the namespace manually and update the annotations of the openshift-security-profiles namespace, or the namespace where the Security Profiles Operator was installed, with openshift.io/node-selector: “”. This removes the default node selector and prevents deployment failures.

Verification
  1. Verify the installation succeeded by inspecting the following CSV file:

    $ oc get csv -n openshift-security-profiles
  2. Verify that the Security Profiles Operator is operational by running the following command:

    $ oc get deploy -n openshift-security-profiles