// Module included in the following assemblies:
//
// * security/external_secrets_operator/external-secrets-operator-install.adoc

:_mod-docs-content-type: PROCEDURE
[id="external-secrets-operator-install-cli_{context}"]
= Installing the {external-secrets-operator} by using the CLI

You can use the command-line interface (CLI) to install the {external-secrets-operator}.

.Prerequisites

* You have access to the cluster with `cluster-admin` privileges.

.Procedure

. Create a new project named `external-secrets-operator` by running the following command:
+
[source,terminal]
----
$ oc new-project external-secrets-operator
----

. Create an `OperatorGroup` object by defining a YAML file with the following content:
+
[source,yaml]
----
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
  name: openshift-external-secrets-operator
  namespace: external-secrets-operator
spec:
  targetNamespaces: []
----

. Create the `OperatorGroup` object by running the following command:
+
[source,terminal]
----
$ oc create -f operatorGroup.yaml
----

. Create a `Subscription` object by defining a YAML file with the following content:
+
The following is an example of a `subscription.yaml` file.
+
[source,yaml]
----
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: openshift-external-secrets-operator
  namespace: external-secrets-operator
spec:
  channel: stable-v1
  name: openshift-external-secrets-operator
  source: redhat-operators
  sourceNamespace: openshift-marketplace
  installPlanApproval: Automatic
  startingCSV: external-secrets-operator.v1.0.0
----

. Create the `Subscription` object by running the following command:
+
[source,terminal]
----
$ oc create -f subscription.yaml
----

.Verification

. Verify that the {olm} subscription is created by running the following command:
+
[source,terminal]
----
$ oc get subscription -n external-secrets-operator
----
+
The following is example output verifying the {olm} subscription is created.
+
[source,terminal]
----
NAME                                  PACKAGE                               SOURCE             CHANNEL
openshift-external-secrets-operator   openshift-external-secrets-operator   redhat-operators   stable-v1
----

. Verify whether the Operator is successfully installed by running the following command:
+
[source,terminal]
----
$ oc get csv -n external-secrets-operator
----
+
The following is example output verifying that the Operator is installed.
+
[source,terminal]
----
NAME                               DISPLAY                                           VERSION   REPLACES   PHASE
external-secrets-operator.v1.0.0   External Secrets Operator for Red Hat OpenShift   1.0.0                Succeeded
----

. Verify that the status of the {external-secrets-operator-short} is `Running` by entering the following command:
+
[source,terminal]
----
$ oc get pods -n external-secrets-operator
----
+
The following is example output verifying the {external-secrets-operator-short} is `Running`.
+
[source,terminal]
----
NAME                                                            READY   STATUS    RESTARTS   AGE
external-secrets-operator-controller-manager-5699f4bc54-kbsmn   1/1     Running   0          25h
----
