Share

Introduction

In my last blog, installing Argo using manifest and HELM, I explained how to install Argo in your private cluster. In this blog, we will learn configurations in Argo CD to fetch application configurations from the public Git repo and deploy the app into a Kubernetes cluster. 

But the software delivery scenario in enterprises will be very different. IT organizations install Source Code Management (SCM) tools like Git or Bitbucket in a secure environment and restrict developers from making their code public. For such scenarios, we will find out how DevOps or platform engineers can configure Argo CD to provide access to the developer’s private Git repositories. (Please note Argo CD supports HTTPS and SSH Git credentials). 

Create and deploy an application using Argo and public github repo

In this section we shall see all the steps required to configure Argo CD to access public repo and deploy an application into the Kubernetes. We will deploy a sample application called ‘guestbook’ which is available in this public repository: https://github.com/argoproj/argocd-example-apps.git 

argo cd guest book

1. At first, please login to the Argocd application, and click on the Applications menu in the left-hand panel. 

argo cd application

2. Click on NEW APP, as shown below.

3. For creating a new application, please provide Application Name, Project Name and SyncPolicy, as asked on the GENERAL section. 

     (Note: you can select SyncPolicy as manual or automatic (if you want Argo CD to sync your Git repo commits with target environment automatically)

Specify the repo Repository URL, Branch and Path in the SOURCE section

4. You can select AUTO-CREATE NAMESPACE to automatically create a namespace for app deployment. 

argo cd application auto create namespace

5. In Specify the repo Repository URL, Branch and Path in the SOURCE section. 

repo Repository URL, Branch and Path in the SOURCE section

6. In the DESTINATION section, you need to specify the cluster details and namespace to deploy the application. By default the cluster (where your Argo is installed currently) will pop up. We shall discuss deploying applications in a different cluster across multi clouds in our next blog.  

You can specify the namespace ( I’ve given demoapp) to create a namespace automatically. 

destination section demoapp

7. To validate if you have entered all the details correctly, you can select EDIT AS YAML button at the top right corner.

create demoapp click on edit yaml
demoapp yaml edit argo cd application

8. After validation, you can click on CREATE to create an application in Argo CD.

CREATE to create an application in Argo CD

9. You will see in your Argo CD UI, the sample new application ‘guestbook’ is created. 

10. If you hit SYNC on the UI, the manifest files gets deployed the cluster and in the demoapp namespace.

demoapp-sync
synchronize
demoapp application argo

11. Once the application is deployed successfully, you will see the status of the activity on Argo UI. You can also verify in your cluster.

Create and deploy application using Argo CD and private Github repo

In this section, we will try to deploy a sample application called HelloWorld (using HELM charts) which is in the Git private repository. 

Link: https://github.com/OpsMx/argo-sample-apps.git 

argo sample apps

1. First, we will Login to the Argocd. After logging in, click on Settings in the left-side panel, and then select on Repositories to configure private Git repo. 

select on Repositories to configure private Git repo

2. We will add the private repository using HTTPS, so we will proceed by clicking ‘CONNECT REPO USING GIT’. 

connect repo using https

3. One has to provide the information such as Project name, Repository URL (I have used OpsMx private repo url for HelloWorld app), Username, and Password.

save as credentials template

4. After filling the infor, click on CONNECT to successfully add a private repository as one of the sources for Argo CD.

click on CONNECT

5. Now, you can click on Applications on the left-hand side of the menu. We will provide the information about the destination where the HelloWorld application will be deployed (the steps are similar to the public repo).

click on applications

6. Click on New APP

click on new app

7. Provide the info Application Name, Project Name, and SyncPolicy (Manual/Automatic)

create application project name

8. Similar to public repo configuration, you can select AUTO CREATE NAMESPACE. And then fill in the details for Repository URL, Revision, and Path. Please provide your newly added private repository in the report URL. 

fill in the details for Repository URL, Revision, and Path
fill repository url path

9. Under the DESTINATION section, select the default cluster and provide a namespace to deploy your application from private repo. 

destination-cluster-url

10. Go to EDIT AS YAML at the top right corner, if you want to validate the configuration, and then create an application.

edit yaml 1

11. You will find demoapp is created in Argo CD UI, but the manifest files are still not deployed. Click on the SYNC to synchronise and deploy the manifest file to the cluster. 

12. After synchronising, the manifest files are deployed into the default cluster. As you can see there are deployment and service files for the HelloWorld app in the below screenshot. 

manifest files are deployed into the default cluster

Conclusion

This brings an end to our article of creating and deploying applications in Argo CD using Git public/private repo. In the next blog, we will find how to deploy applications into clusters in another cloud or data centre.

In case you want to try a secured, reliable and production-ready SaaS Argo CD, please read about OpsMx Enterprise for Argo (OEA).

You can also book an Argo CD in the sandbox here.

Mahesh Kumar K

Mahesh Kumar K has 5+ years of experience in DevOps with CI/CD, k8s, spinnaker,argo,aws,jenkins,docker, sso,secret management SCM,vault,conjure,kms, shell scripting automation. Certified on CKA certification

Link

0 Comments

Submit a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

You May Like

Argo has Graduated!

December 6, 2022
Share