OpenShift Container Platform provides the following CLI tools:
- OpenShift CLI (oc): This is the most popular CLI tool among OpenShift Container Platform users. It enables both cluster administrators and developers to do end-to-end activities on the OpenShift Container Platform via the terminal. Unlike the web console, it lets the user to interact directly with the project's source code via command script.
- Knative CLI (kn): The Knative (kn) CLI tool offers simple and intuitive terminal commands for interacting with OpenShift Serverless components including Knative Serving and Eventing.
- Pipelines CLI (tkn): OpenShift Pipelines is a CI/CD solution for the OpenShift Container Platform that leverages Tekton internally. The tkn CLI tool provides simple and clear commands for interacting with OpenShift Pipelines from the terminal.
- opm CLI: The opm CLI tool allows Operator developers and cluster administrators to generate and maintain Operator catalogs directly from the terminal.
- Operator SDK: The Operator SDK, a component of the Operator Framework, is a command-line tool that allows Operator developers to build, test, and deploy Operators directly from the terminal. It streamlines the process of developing Kubernetes-native applications, which can necessitate extensive application-specific operational knowledge.
GitOps CLI
The GitOps argocd CLI allows you to configure and manage Red Hat OpenShift GitOps and Argo CD resources from your terminal.
The GitOps CLI makes GitOps computational chores simple and straightforward. You can install this CLI utility on a variety of platforms.
Red Hat OpenShift GitOps makes use of Argo CD to manage cluster-specific resources such as cluster Operators, optional Operator Lifecycle Manager (OLM) Operators, and user management.
Installation
Red Hat OpenShift GitOps is a declarative approach to implementing continuous deployment for cloud-native apps. GitOps allows you to specify and configure the CPU and memory needs of your application.
When you install the Red Hat OpenShift GitOps Operator, the resources in the namespace are installed within the specified restrictions. If the default installation does not specify any limitations or requests, the Operator fails within the namespace with quotas. Without sufficient resources, the cluster cannot schedule ArgoCD-related pods.
You can also use the ArgoCD custom resource with the oc
command to see the specifics and modify them:
oc edit argocd <name of argo cd> -n namespace
If you've already installed the Argo CD Community Operator, uninstall it before installing the Red Hat OpenShift GitOps Operator.
The 'latest' channel installs the latest stable version of the Red Hat OpenShift GitOps Operator. Currently, it is the default installation channel for the Red Hat OpenShift GitOps Operator.
Cluster administrators can install a specific version of the Red Hat OpenShift GitOps Operator through the 'gitops-' channel. For example, to install Red Hat OpenShift GitOps Operator version 1.9.x, use the 'gitops-1.9' channel.
Using Web console
You can install Red Hat OpenShift GitOps Operator from the OperatorHub by using the web console.
- Open the Administrator perspective of the web console and go to Operators → OperatorHub.
- Search for OpenShift GitOps, click the Red Hat OpenShift GitOps tile, and then click Install.
- On the Install Operator page:
- Select an Update channel.
- Select a GitOps Version to install.
- Choose an Installed Namespace. The default installation namespace is
openshift-gitops-operator
. - For the GitOps version 1.10 and later, the default namespace changed from
openshift-operators
toopenshift-gitops
operator. - Select the Enable Operator recommended cluster monitoring on this Namespace checkbox to enable cluster monitoring.
- You can enable cluster monitoring on any namespace by applying the
openshift.io/cluster-monitoring=true
label: $ oc label namespace <namespace> openshift.io/cluster-monitoring=true
- Verify that the Red Hat OpenShift GitOps Operator is listed in Operators → Installed Operators. The Status should resolve to Succeeded.
- After the Red Hat OpenShift GitOps Operator is installed, it automatically sets up a ready-to-use Argo CD instance that is available in the
openshift-gitops
namespace, and an Argo CD icon is displayed in the console toolbar. You can create subsequent Argo CD instances for your applications under your projects.
Using CLI
You can install Red Hat OpenShift GitOps Operator from the OperatorHub by using the CLI.
For the GitOps version 1.10 and later, the default namespace changed from openshift-operators
to openshift-gitops
operator.
Create a openshift-gitops-operator namespace:
$ oc create ns openshift-gitops-operator
namespace/openshift-gitops-operator created
You can enable cluster monitoring on openshift-gitops-operator, or any namespace, by applying the openshift.io/cluster-monitoring=true
label:
$ oc label namespace <namespace> openshift.io/cluster-monitoring=true
namespace/<namespace> labeled
Create a OperatorGroup object YAML file - gitops-operator-group.yaml
:
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
name: openshift-gitops-operator
namespace: openshift-gitops-operator
spec:
upgradeStrategy: Default
Apply the OperatorGroup to the cluster:
$ oc apply -f gitops-operator-group.yaml
operatorgroup.operators.coreos.com/openshift-gitops-operator created
Create a Subscription object YAML file to subscribe a namespace to the Red Hat OpenShift GitOps Operator, for example, openshift-gitops-sub.yaml
:
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: openshift-gitops-operator
namespace: openshift-gitops-operator
spec:
channel: latest # Specify the channel name from where you want to subscribe the Operator.
installPlanApproval: Automatic
name: openshift-gitops-operator # Specify the name of the Operator to subscribe to.
source: redhat-operators # Specify the name of the Operator to subscribe to.
sourceNamespace: openshift-marketplace # The namespace of the CatalogSource. Use openshift-marketplace for the default OperatorHub CatalogSources.
Apply the Subscription to the cluster:
$ oc apply -f openshift-gitops-sub.yaml
subscription.operators.coreos.com/openshift-gitops-operator created
After the installation is complete, verify that all the pods in the openshift-gitops namespace are running:
$ oc get pods -n openshift-gitops
NAME READY STATUS RESTARTS AGE
cluster-b5798d6f9-zr576 1/1 Running 0 65m
kam-69866d7c48-8nsjv 1/1 Running 0 65m
openshift-gitops-application-controller-0 1/1 Running 0 53m
openshift-gitops-applicationset-controller-6447b8dfdd-5ckgh 1/1 Running 0 65m
openshift-gitops-dex-server-569b498bd9-vf6mr 1/1 Running 0 65m
openshift-gitops-redis-74bd8d7d96-49bjf 1/1 Running 0 65m
openshift-gitops-repo-server-c999f75d5-l4rsg 1/1 Running 0 65m
openshift-gitops-server-5785f7668b-wj57t 1/1 Running 0 53m
Verify that the pods in the openshift-gitops-operator namespace are running:
$ oc get pods -n openshift-gitops-operator
NAME READY STATUS RESTARTS AGE
openshift-gitops-operator-controller-manager-664966d547-vr4vb 2/2 Running 0
Ref: https://docs.openshift.com/container-platform/4.16/cli_reference/index.html
Ref: https://docs.openshift.com/gitops/1.13/installing_gitops/installing-argocd-gitops-cli.html
Top comments (0)