$ git clone git@github.com:redhat-developer/openshift-gitops-getting-started.git
With Argo CD, you can deploy your applications to the OpenShift cluster either by using the Argo CD dashboard or by using the oc
tool.
Red Hat OpenShift GitOps is installed in your cluster.
Red Hat OpenShift GitOps Operator automatically creates a ready-to-use Argo CD instance that is available in the openshift-gitops
namespace.
You have installed the Red Hat OpenShift GitOps Operator in your cluster.
In the Administrator perspective of the web console, navigate to Operators → Installed Operators to verify that the Red Hat OpenShift GitOps Operator is installed.
Navigate to the menu → OpenShift GitOps → Cluster Argo CD. The login page of the Argo CD UI is displayed in a new window.
Obtain the password for the Argo CD instance:
Navigate to the Developer perspective of the web console. A list of available projects is displayed.
Navigate to the openshift-gitops
project.
Use the left navigation panel to navigate to the Secrets page.
Select the openshift-gitops-cluster instance to display the password.
Copy the password.
Use this password and admin
as the username to log in to the Argo CD UI in the new window.
Argo CD provides a dashboard which allows you to create applications.
In the Argo CD dashboard, click NEW APP to add a new Argo CD application.
For this workflow, create a spring-petclinic application with the following configurations:
spring-petclinic
default
Automatic
https://github.com/redhat-developer/openshift-gitops-getting-started
HEAD
app
spring-petclinic
Click CREATE to create your application.
Open the Administrator perspective of the web console and navigate to Administration → Namespaces in the menu on the left.
Search for and select the namespace, then enter argocd.argoproj.io/managed-by=openshift-gitops
in the Label field so that the Argo CD instance in the openshift-gitops
namespace can manage your namespace.
oc
toolYou can create Argo CD applications in your terminal by using the oc
tool.
Download the sample application:
$ git clone git@github.com:redhat-developer/openshift-gitops-getting-started.git
Create the application:
$ oc create -f openshift-gitops-getting-started/argo/app.yaml
Run the oc get
command to review the created application:
$ oc get application -n openshift-gitops
Add a label to the namespace your application is deployed in so that the Argo CD instance in the openshift-gitops
namespace can manage it:
$ oc label namespace spring-petclinic argocd.argoproj.io/managed-by=openshift-gitops
Argo CD constantly monitors the state of deployed applications, detects differences between the specified manifests in Git and live changes in the cluster, and then automatically corrects them. This behavior is referred to as self-healing.
You can test and observe the self-healing behavior in Argo CD.
The sample app-spring-petclinic
application is deployed and configured.
In the Argo CD dashboard, verify that your application has the Synced
status.
Click the app-spring-petclinic
tile in the Argo CD dashboard to view the application resources that are deployed to the cluster.
In the OpenShift web console, navigate to the Developer perspective.
Modify the Spring PetClinic deployment and commit the changes to the app/
directory of the Git repository. Argo CD will automatically deploy the changes to the cluster.
Test the self-healing behavior by modifying the deployment on the cluster and scaling it up to two pods while watching the application in the OpenShift web console.
Run the following command to modify the deployment:
$ oc scale deployment spring-petclinic --replicas 2 -n spring-petclinic
In the OpenShift web console, notice that the deployment scales up to two pods and immediately scales down again to one pod. Argo CD detected a difference from the Git repository and auto-healed the application on the OpenShift cluster.
In the Argo CD dashboard, click the app-spring-petclinic tile → APP DETAILS → EVENTS. The EVENTS tab displays the following events: Argo CD detecting out of sync deployment resources on the cluster and then resyncing the Git repository to correct it.