Amazon EKS and ArgoCD
Build and Deploy CI/CD Pipeline with Amazon EKS and ArgoCD
“GitOps is an operational framework that takes DevOps best practices used for application development such as version control, collaboration, compliance, and CI/CD, and applies them to infrastructure automation.” — A beginner’s guide to GitOps.
Hello everyone, so in this article I am going to talk about how to work with Amazon EKS and ArgoCD. First let me explain you what is this GitOps and ArgoCD. So, let’s dig in.
What is GitOps? 🤔
As I mentioned in the top of article, GitOps is a code-based infrastructure and operational approach, that based on a Git as a source control system. Application developers are already using the Git and GitOps extends this with application configuration, infrastructure and operational procedures. Let’s say you have Git repository that include application code files, infrastructure and configuration code files that related to your application. When you do the git push, it will trigger the changes and will update your application or the infrastructure.
Principles and how to start with Gitops
According to the CodeFresh, there are 4 principles of GitOps.
- Declarative Configuration
- Version Controlled, Immutable Storage
- Automatic Pull Operations
- Continuous Reconciliation
To start with GitOps, you need to know about the following practices:
- Git Workflows
- CD Pipelines
- Infrastructure as Code (IaC)
- Tacking and Observability
- Immutable Servers (Containerized Infrastructure)
You can refer this article from CodeFresh to learn more about the GitOps. What is GitOps? Benefits, Principles, and How to Get Started (codefresh.io). Next let’s what is ArgoCD.
What is ArgoCD?🤔
Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes applications. It uses the GitOps style to create and manage Kubernetes clusters.
The main thing in ArgoCD is it, can pull updated code from Git repositories and deploy it directly to Kubernetes resources. So, can manage both infrastructure configuration and application updates in one system. ArgoCD identifies deployed applications with a live state that deviates from the desired state as OutOfSync, so we can monitor it through the ArgoCD UI and do manually or automatically sync the live state with the desired state.
So, now I think you have a brief idea about the GitOps and ArgoCD. Let’s create and simple application and deploy to the EKS. Let’s get started.
Setting up the Application
Get Pium Sudhara’s stories in your inbox
Join Medium for free to get updates from this writer.
First of all, let’s create our application. In this case I will create simple HTML page. And you need to dockerize the above HTML file.
- Then you have to create Helm charts. Helm Chart is a YAML configuration, which defines a package of pre-configured resources that can be deployed in a Kubernetes cluster.
- In values.yaml file you can see I have already use my ECR repository. Make sure you have created ECR. Or else you have used your Docker Hub repository.
- Last thing is to configure your workflow or the pipeline. You can configure it through the GitHub or config through the code.
- Now your file structure should like this.
- After all the configurations, commit your changes and push into the Git. Then our GitHub workflow will run automatically and build and push our image into the ECR.
- Now we have setup application. Next is to config our EKS cluster and ArgoCD.
Configure EKS and ArgoCD
To setup EKS and ArgoCD I am using Ubuntu on WSL2. You can use following commands to create a EKS cluster and config ArgoCD on the EKS.
- Once the EKS cluster created and configue the ArgoCD on cluster, let’s create application on ArgoCD.
- Click create application on ArgoCD CLI. And set the following values for the application.
- Then click create. And you will be redirected into your newly created application on cluster.
As you can see our application now on syned and healthy status, let’s check our application on AWS Load Balancer.
Ok, now our application on healthy, let’s do a little change that increase our pods size into 5. To do that need to change the values.yaml on our application and push the changes into Git. Once do the chages we can get following output.
Now let’s see from the start. We have implemented an application and deploy it to the AWS ECR using GitHub Actions. And using that image we have deployed an AWS EKS cluster with ArgoCD. All the changesa are automatically, and we don’t have to do anything. Everything is automated.
Ohh, and don’t forget. If you are not going to use the appplication make sure to delete all the resources that you are provisioned. 😉
Repository: piumsudhara/ArgoEKS (github.com)
Conclusion
So, in this article I have talked about what is GitOps, ArgoCD and how to integrate with AWS EKS, ECR and how to with Helm charts on Kubernetes. I hope this article will help you to know about basics about them.
So, let’s meet in next article. Next, I will come to you with an interesting article. If you need any help follow me on GitHub, LinkedIn or Twitter. Happy coding!!
That’s it, thank you all...! don’t forget to leave a 👏✌️❤️











