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
1. At first, please login to the Argocd application, and click on the Applications menu in the left-hand panel.
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)
4. You can select AUTO-CREATE NAMESPACE to automatically create a namespace for app deployment.
5. In Specify the 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.
7. To validate if you have entered all the details correctly, you can select EDIT AS YAML button at the top right corner.
8. After validation, you can click on 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.
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.
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.
2. We will add the private repository using HTTPS, so we will proceed by clicking ‘CONNECT REPO USING GIT’.
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.
4. After filling the infor, click on CONNECT to successfully add a private repository as one of the sources for Argo CD.
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).
6. Click on New APP
7. Provide the info Application Name, Project Name, and SyncPolicy (Manual/Automatic)
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.
9. Under the DESTINATION section, select the default cluster and provide a namespace to deploy your application from private repo.
10. Go to EDIT AS YAML at the top right corner, if you want to validate the configuration, and then create an application.
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.
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.
If you need to save all the hassle and get started with enterprise-wide GitOps deployment, then use OpsMx Intelligent Software Delivery (ISD) for Argo, which comes with all the bells and whistles for security and scale requirements for your software delivery. ISD for Argo free trial available.
OpsMx also provides Argo Center of Excellence (COE) for enterprises needing expert services or consultation on Argo CD and Argo Rollout implementation to expedite their GitOps journey.
Founded with the vision of “delivering software without human intervention,” OpsMx enables customers to transform and automate their software delivery processes. OpsMx builds on open-source Spinnaker and Argo with services and software that helps DevOps teams SHIP BETTER SOFTWARE FASTER.