Back to Argo CD…!! So far on Argo CD we have see how to create the deploy Argo CD and create the application manually. In this post let’s see how we can automate the Argo CD application creation. We all aware of and also seen in previous post Argo CD makes pull based GitOps deployment. In sort it simply listens to the repo and apply the manifest files to the cluster. Same will be applied here, we can keep all the configuration in repo including its internals, Rest will be taken care by Argo CD.
In this post will see couple of application created automatically from github.
Prerequisites:
- Azure Kubernetes Service up and running, if you don’t have one, please follow the steps with terraform to create it. How to create Azure Kubernetes Service using Terraform — FoxuTech
- Kubectl installed in the VM or machine you are going to manage the AKS.
- Have a kubeconfig file (default location is ~/.kube/config).
- Argo CD setup. If not, available you can refer Setup ArgoCD on Azure Kubernetes Services — FoxuTech
- Install ArgoCD CLI also from Setup ArgoCD on Azure Kubernetes Services — FoxuTech.
Let’s create sample deployments
Before we created the Argo CD Applications, lets create the basic deployment, let’s create the sample deployments with nginx. I have followed the folder structure, argocd/example/app-of-app in my repository and inside that have create two applications.
Here the sample deployments for your reference.
Webapp-1:
apiVersion: apps/v1
kind: Deployment
metadata:
name: webapp-1
labels:
app: webapp-1
spec:
replicas: 3
selector:
matchLabels:
app: webapp-1
template:
metadata:
labels:
app: webapp-1
spec:
containers:
- name: nginx
image: nginx:latest
ports:
- containerPort: 80
Webapp-2:
apiVersion: apps/v1
kind: Deployment
metadata:
name: webapp-2
labels:
app: webapp-2
spec:
replicas: 3
selector:
matchLabels:
app: webapp-2
template:
metadata:
labels:
app: webapp-2
spec:
containers:
- name: nginx
image: nginx:latest
ports:
- containerPort: 80
We are good with our deployment, now we should create Argo CD Applications pointing to this deployment Manifests.
Argo CD can be configured in three different ways: using the GUI, using the CLI, or using Kubernetes Manifest files. In previous post we have seen first two options, now let’s see third method.
Create the following Manifest files in a new folder argocd/test-apps. This is test-apps/webapp-1.yml:
Continue reading on https://foxutech.com/how-to-create-the-application-automatically-using-argo-cd/
YouTube: Check the complete demo on or only related to this article can referred from 17:00 minute.
You can follow us on social media, to get some short knowledges regularly.
- Facebook: https://www.facebook.com/foxutech/
- Instagram: https://www.instagram.com/foxutech/
- YouTube: Foxutech
- Twitter: https://twitter.com/foxutech
- Buy me a coffee: https://www.buymeacoffee.com/foxutech