ArgoCD Lab
Pre-requisites
Make sure your environment is setup properly for the lab.
Check the Environment Setup page for your setup.
ArgoCD Installation
- Create the namespace
argocd
to install argocdoc new-project argocd - Install ArgoCD as follows.oc apply --filename https://raw.githubusercontent.com/ibm-cloud-architecture/learning-cloudnative-101/master/static/yamls/argo-lab/argocd-operator.yaml
- When installing the tutorial, make sure you wait until the argocd-operator is finished before installing the argocd-cr..or it will fail. You can do this:
and wait for the “succeeded” to come up before proceeding.oc get ClusterServiceVersion -n argocdNAME DISPLAY VERSION REPLACES PHASEargocd-operator.v0.0.8 Argo CD 0.0.8 Succeeded
and wait for the argocd server Pod to be runningoc apply --filename https://raw.githubusercontent.com/ibm-cloud-architecture/learning-cloudnative-101/master/static/yamls/argo-lab/argocd-cr.yamloc get pods -n argocd -l app.kubernetes.io/name=example-argocd-serverNAME READY STATUS RESTARTS AGEexample-argocd-server-57c4fd5c45-zf4q6 1/1 Running 0 115s - Install the
argocd
CLI, for example on OSX use brewbrew tap argoproj/tapbrew install argoproj/tap/argocd - Set an environment variable
ARGOCD_URL
using theEXTERNAL-IP
export ARGOCD_NAMESPACE="argocd"export ARGOCD_SERVER=$(oc get route example-argocd-server -n $ARGOCD_NAMESPACE -o jsonpath='{.spec.host}')export ARGOCD_URL="https://$ARGOCD_SERVER"echo ARGOCD_URL=$ARGOCD_URLecho ARGOCD_SERVER=$ARGOCD_SERVER
Deploying the app
- Login into the UI.open $ARGOCD_URL
- Use
admin
as the username and get the password with the following command
For example the output is similar to this:oc get secret example-argocd-cluster -n $ARGOCD_NAMESPACE -o jsonpath='{.data.admin\.password}' | base64 -dtyafMb7BNvO0kP9eizx3CojrK8pYJFQq

- Now go back to the ArgoCD home and click on
NEW APP
. - Add the below details:
- Application Name:
sample
- Project -
default
- SYNC POLICY:
Manual
- REPO URL:
https://github.com/ibm-cloud-architecture/cloudnative_sample_app_deploy
- Revision:
HEAD
- Path:
openshift

- Cluster - Select the default one
https://kubernetes.default.svc
to deploy in-cluster - Namespace -
default
- Click Create to finish

- You will now see the available apps.

- Initially, the app will be out of sync. It is yet to be deployed. You need to sync it for deploying.
To sync the application, click SYNC
and then SYNCHRONIZE
.

- Wait till the app is deployed.

- Once the app is deployed, click on it to see the details.


Verifying the deployment
- Access the app to verify if it is correctly deployed.
- List the cloudnativesampleapp-service route
It should have an IP underoc get routeEXTERNAL-IP
columnNAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARDcloudnative-sample cloudnative-sample-default.apps-crc.testing cloudnativesampleapp-service 9080 None - Set an environment variable
APP_URL
using theEXTERNAL-IP
export APP_URL="http://$(oc get route cloudnative-sample -o jsonpath='{.status.ingress[0].host}')"echo ARGOCD_SERVER=$APP_URL - Access the url using
curl
curl "$APP_URL/greeting?name=Carlos"{"id":2,"content":"Welcome to Cloudnative bootcamp !!! Hello, Carlos :)"}
Using the ArgoCD CLI
Login using the cli.
Use
admin
as the username and get the password with the following commandexport ARGOCD_PASSWORD=$(oc get secret example-argocd-cluster -n $ARGOCD_NAMESPACE -o jsonpath='{.data.admin\.password}' | base64 -d)echo $ARGOCD_PASSWORDNow login as follows.
argocd login --username admin --password $ARGOCD_PASSWORD $ARGOCD_SERVERWARNING: server certificate had error: x509: cannot validate certificate for 10.97.240.99 because it doesn't containany IP SANs. Proceed insecurely (y/n)? y'admin' logged in successfullyContext 'example-argocd-server-argocd.apps-crc.testing' updatedList the applications
argocd app listNAME CLUSTER NAMESPACE PROJECT STATUS HEALTH SYNCPOLICY CONDITIONS REPO PATH TARGETsample https://kubernetes.default.svc default default Synced Healthy <none> <none> https://github.com/ibm-cloud-architecture/cloudnative_sample_app_deploy openshift HEADGet application details
argocd app get sampleName: sampleProject: defaultServer: https://kubernetes.default.svcNamespace: defaultURL: https://10.97.240.99/applications/sampleRepo: https://github.com/ibm-cloud-architecture/cloudnative_sample_app_deployTarget: HEADPath: openshiftSyncWindow: Sync AllowedShow application deployment history
argocd app history sampleID DATE REVISION0 2020-02-12 21:10:32 -0500 EST HEAD (9684037)