Argo CD is a pull-based k8s-native continuous deployment(CD) tool. It automates the deployment of Kubernetes resources defined in a repository by cloning the source and applying the relevant manifests to the target cluster. Argo CD has a controller that ensures the live or current state of the target Kubernetes cluster matches the desired state in the source repository. Argo CD is completely supported on IBM Power from v2.4.14.
In this tutorial, we will set up Argo CD on the IBM Power Kubernetes cluster and synchronize resources with our GitHub repository.
Pre-requisites:
IBM Power Openshift cluster
You can deploy a Red Hat OpenShift cluster on IBM Power Systems Virtual Servers using the steps in this article: https://developer.ibm.com/components/ibm-power/tutorials/install-ocp-on-power-vs/
Step 0: Install Argo CD:
$ kubectl create namespace argocd $ kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
Step 1: Download Argo CD CLI:
$ wget https://github.com/argoproj/argo-cd/releases/download/v2.4.15/argocd-linux-ppc64le$ chmod u+x argocd-linux-ppc64le$ mv argocd-linux-ppc64le /usr/local/bin/argocd$ argocd version
Step 2: Access the Argo CD API Server:
By default, the Argo CD API server is not exposed to an external IP. To access the API server, we will do port forwarding of the argocd-server service on the 8080 port.
$ kubectl port-forward svc/argocd-server -n argocd 8080:443 --address localhost,<Public_IP_of_CLuster_API>
Now, we can see the Argo CD UI Page on http://<Public_IP_of_CLuster_API>:8080
Step 3: Login to Argo CD from UI and CLI:
The initial password for the admin account is auto-generated and stored as clear text in the field password in a secret named argocd-initial-admin-secret in your Argo CD installation namespace. You can simply retrieve this password using.
$ kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo
Using the username admin and the password from above, login to Argo CD.
This is the UI page of Argo CD after logging in
Login from CLI:
For logging from the CLI, run the below command:
$ argocd login <Public_IP_of_CLuster_API>:8080
After login, you can run many commands like :
argocd cluster list → To check the cluster to which Argo CD is connected with
argocd app list → To check all the running applications
argocd repo list → To check all Git or Helm repositories to which Argo CD is connected with
argocd proj list → To list down all the projects created in Argo CD
Step 4: Create an Application From Git Repository:
We are going to use a simple demo application present here to demonstrate how Argo CD works on IBM Power.
Creating Apps via CLI
Create the example demo-app application with the following command:
$ argocd app create demo-app --repo https://github.com/mayurwaghmode/argocd-demo.git --path simple-app --dest-server https://kubernetes.default.svc --dest-namespace default
Step 5: Sync (Deploy) the Application:
Syncing via CLI
$ argocd app get demo-app
Name: demo-app
Project: default
Server: https://kubernetes.default.svc
Namespace: default
URL: https://9.46.199.51:8080/applications/demo-app
Repo: https://github.com/mayurwaghmode/argocd-demo.git
Target:
Path: simple-app
SyncWindow: Sync Allowed
Sync Policy: <none>
Sync Status: OutOfSync from (145e931)
Health Status: Missing
GROUP KIND NAMESPACE NAME STATUS HEALTH HOOK MESSAGE
Service default myapp-service OutOfSync Missing
apps Deployment default myapp OutOfSync Missing
The application status is initially in OutOfSync state since the application has yet to be deployed, and no Kubernetes resources have been created. To sync (deploy) the application, run:
$ argocd app sync demo-app
This command retrieves the manifests from the repository and performs a kubectl apply of the manifests. The demo-app application is now running and you can now view its resource components, logs, events, and assessed health status.
The Synced and Healthy status signifies that all the resources that should be applied have been created in the cluster and that they are running successfully.
That’s all folks! Thanks for reading. Hope this tutorial was helpful.
CKA | Cloud | CICD | DevOps Engineer at Teradata
Acesse os conteúdos, aqui!
Comments