ArgoCD Lab
- Pre-requisites
- Introduction
- ArgoCD Installation
- Deploying the Application
- Verifying the deployment
- Using the ArgoCD CLI
- References
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/argocd-operator-helm.v0.0.3 -n argocdNAME DISPLAY VERSION REPLACES PHASEargocd-operator-helm.v0.0.3 Argo CD Operator (Helm) 0.0.3 argocd-operator-helm.v0.0.2 Succeededoc apply --filename https://raw.githubusercontent.com/ibm-cloud-architecture/learning-cloudnative-101/master/static/yamls/argo-lab/argocd-cr.yaml - 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_SERVER="$(oc get route argocd-server -n argocd -o jsonpath='{.status.ingress[0].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, it’s the name of the pod for the argo-server
For example the output is similar to this:oc get pods -n argocd -l app.kubernetes.io/name=argocd-server -o name | cut -d'/' -f 2argocd-server-b54756f69-jncc9
- 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.
Login as the
admin
user.The initial password is autogenerated to be the pod name of the Argo CD API server. This can be retrieved with the following command.
oc get pods -n argocd -l app.kubernetes.io/name=argocd-server -o name | cut -d'/' -f 2Now login as follows.
argocd login $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)? yUsername: adminPassword:'admin' logged in successfullyContext '10.97.240.99' 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)
References
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 argocdkubectl create namespace argocd - Install ArgoCD as follows.kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
- Install the
argocd
CLI, for example on OSX use brewbrew tap argoproj/tapbrew install argoproj/tap/argocd - To allow access via LoadBalancer and leverage the
minikube tunnel
running in the background, patch the argocd server servicekubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}' - List the argocd-server service
It should have an IP underkubectl get svc argocd-server -n argocdEXTERNAL-IP
columnNAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGEargocd-server LoadBalancer 10.97.240.99 10.97.240.99 80:30286/TCP,443:31716/TCP 41s - Set an environment variable
ARGOCD_URL
using theEXTERNAL-IP
export ARGOCD_SERVER="$(kubectl get svc argocd-server -n argocd -o jsonpath='{.status.loadBalancer.ingress[0].ip}')"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, it’s the name of the pod for the argo-server
For example the output is similar to this:kubectl get pods -n argocd -l app.kubernetes.io/name=argocd-server -o name | cut -d'/' -f 2argocd-server-b54756f69-jncc9
- 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:
kubernetes
- 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.
- To allow access via LoadBalancer and leverage the
minikube tunnel
running in the background, patch the argocd server servicekubectl patch svc cloudnativesampleapp-service -p '{"spec": {"type": "LoadBalancer"}}' - List the cloudnativesampleapp-service service
It should have an IP underkubectl get svc cloudnativesampleapp-serviceEXTERNAL-IP
columnNAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGEcloudnativesampleapp-service LoadBalancer 10.109.242.212 10.109.242.212 9080:31905/TCP 13m - Set an environment variable
APP_URL
using theEXTERNAL-IP
export APP_URL="http://$(kubectl get svc cloudnativesampleapp-service -o jsonpath='{.status.loadBalancer.ingress[0].ip}'):9080"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.
Login as the
admin
user.The initial password is autogenerated to be the pod name of the Argo CD API server. This can be retrieved with the following command.
kubectl get pods -n argocd -l app.kubernetes.io/name=argocd-server -o name | cut -d'/' -f 2Now login as follows.
argocd login $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)? yUsername: adminPassword:'admin' logged in successfullyContext '10.97.240.99' 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 kubernetes 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: kubernetesSyncWindow: Sync AllowedShow application deployment history
argocd app history sampleID DATE REVISION0 2020-02-12 21:10:32 -0500 EST HEAD (9684037)