Home  > Resources  > Blog

Deploy an Application Using ArgoCD

 
April 13, 2023 by Bibhas Bhattacharya
Category: DevOps

In this tutorial, we will deploy an application using ArgoCD. It is a multi-step process.

  1. Add a deployment manifest file to the Git repository.
  2. Point ArgoCD to the Git repository. It will begin monitoring changes.
  3. When a change is detected you can manually synchronize. This will pull the deployment manifest file and apply it to the Kubernetes cluster.

For ArgoCD training for your team, please visit our GitOps Using ArgoCD course or Contact Us for Group Training Information.

Part 1 – Add Deployment Manifest to the Application Repository

  1. Open a file browser.
  2. 4. Run these commands to commit and push the changes. Use your GitHub PAT when
    prompted for the password:
  3. Copy the deployment.yaml file that was used earlier into that folder.
deployment.yaml

4. Run these commands to commit and push the changes. Use your GitHub PAT when
prompted for the password:

cd ~/gitops-demo-webapp/gitops-config/
git add .
git commit -m"Add deployment manifest"
git push
[Enter you GitHub user and your GitHub PAT (TOKEN) when prompted for
the password, remember that this was saved in a file in a previous lab]

Example:

Part 2 – Define a Git Repository in ArgoCD

  1. Log out and then login into the ArgoCD web console.
  2. Click the settings button.
Define a Git Repository in ArgoCD

3. Click Repositories.
4. Click CONNECT REPO.

Connect Repo

5. Click the Choose your connection method drop down and select VIA HTTPS.

6. Enter the following values:

Type: git
Project: default
Repository URL: https://github.com/your GITHub user/gitops-demo-webapp
Username: Your GitHub user
Password: Your GitHub PAT

As in the example:

7. At the top, click CONNECT

Make sure the connection is successful.

Part 3 – Define an Application

An application is basically a folder inside the Git repo where manifest YAML files are
stored. We will now define an application in ArgoCD.
1. Open the menu for the Git repo and click Create application.

  1. For the application’s name enter demo. The name must be lowercase and aside from
    letters and numbers can only have “-” or “.” in it.
  2. For the project, name enter default. It must be default at this time.

4. Leave the synchronization policy to manual for now.

5. Scroll to the SOURCE section.

6. In the Revision area, enter main as the branch name.

7. In the Path text box enter gitops-config. This is where we store our YAML files.

8. In the DESTINATION section, under cluster URL, enter https://kubernetes.default.svc. This tells ArgoCD that the application will be deployed
in the same cluster as where ArgoCD itself is installed.
9. In the Namespace text box enter the default

10. Finally click the CREATE button at the top.

Verify that the application is created. The status will show as Missing because we have never synchronized the application yet.

Part 4 – Synchronize the Application

This step will make ArgoCD pull the deployment manifest file and apply it to the cluster.
1. Click the application’s name to view the manifest details.

As we have defined in the deployment.yaml file, a service component called gitops-demo, and a deployment component called gitops-demo will be created.

2. Click the SYNC button at the top to begin the synchronization process.

3. Then, click SYNCHRONIZE.

Verify that the synchronization went without an error.

  1. In the Terminal, run this command to verify that the application’s pod is up and
    running:
kubectl get pods

Part 5 – Test the Application

  1. Run this command to create a public URL for the application
minikube service gitops-demo --url

2. You will get a response, copy the <SERVICE URL>
3. Run this command to send a request to the application replacing your . Make sure you add “/hello” to the URL:

curl <SERVICE URL>/hello

Verify that you see this response:

{"requestCount":1,"greeting":"Hello!"}

Part 6 – Review

In this tutorial, we deployed an application using ArgoCD.

For ArgoCD training for your team, please visit our GitOps Using ArgoCD course or Contact Us for Group Training Information.

Follow Us

Blog Categories