In the previous article, we deployed a gitops tool but it doesn’t matter if we can’t do anything interesting.
Remember that we installed this tool because we believed in the paradigm that helps automate deployment and infrastructure provisioning.
The main elements and activities of this tool involved are:
- A git tool, it’s no more, no less than an open source tool to manage the life cycle of code.
- Automation, at the moment the GitOps tool process is triggered by the changes that happened in a git repository. This process automatically deploys applications and infrastructure.
- Audibility, because, in the git repository, we could review and monitor a detailed audit trail of changes. On the other hand, it is a source truth that represents the full system state.
So, to understand these concepts, I created a repository and made a demo to introduce some changes in the repository that support my words in the paragraph above.
let’s go and be hands-on!
Preparing Git repository
Let’s start with adding a repository in the argo-cd tool, but check to have the following prerequisites:
- pass obtained by kubectl commands.
- URL, user and port to access the application in a browser.
In this example, I’ll add a repository personal public repository and push/pull the code after making some changes. The repository contains a simple application that I’ve obtained from NginxWeb.
- After login, please click on the settings menu.
- Choice + connect repo and complete the fields with:
|Connection Method||git (helm we’ll use in another article.)|
|type||git (helm we’ll use in other article.)|
|project||default (for now, we use this default created in the deployment.)|
|password||password token provisioned by your git tool.|
- After completing all fields, check Connect button at the top, to check and save the repository and look as this:
Just now we have configured the repository in argo and this situation gives us the advantage of:
- Deploy the application.
- Pull the repo and introduce some changes.
- Push the changes, and check the process trigged by this change in argo-cd.
The repository contains an application called, book info and a YAML file with the necessary artefacts to deploy an application in Kubernetes.
Deploy the application.
In the Argo CD web interface, choose applications -> + app
And show a complete window form to complete. It’s possible to automate by code, by the Argo command line interface but it’s not the scope of the article.
In the general section, we must choose the real policy of automation of changes for our application, because we choose whether the changes triggered are automated. It depends on the maturity grade of the application and the controls in the middle by the release manager. Your application could apply the changes automatically or show advice for you, that happened to some changes in your application. And you will push the “apply” button.
|project name||default (in the future ‘ll create a new project, don’t worry ;))|
|sync policy||default (in the future create a new project, don’t worry ;))|
|prune propagation policy||foreground|
This section is designated as the repository section and where to obtain the code version.
|repository url (argo show options)||https://github.com/juanmercadoit/argocd-demo.git|
|head (refers to branches)||head|
|path (maybe you could have a lots of projects, in this case only one.)||./|
About the cluster where to deploy the application and the namespace reserved.
|cluster URL (your Kubernetes URL, I’m using a local cluster)||https://kubernetes.default.svc|
Save all configurations and push the Create button on top.
So, now appears on the screen the app deployed, awaiting to sync the order and is finished.
Press the SYNC button and check how the application deploys automatically.
Congratulations! You have your first application with Argo CD.
Check your application
Please, check the applications run, exporting the service and port, and browser.
kubectl port-forward svc/productpage -n testing 8081:9080
put the URL and check!
We choose an infrastructure change by code and scale the application pod, from 1 to 3 pods.
See you in the next article to introduce the changes, the three and last part :
GITOPS: Argo CD AND APPLICATION DEPLOYMENT – PART III
I hope this article has helped and given some idea about the Argo deployments.