Skip to content

sean-njela/argocd-demo

Repository files navigation

logo

Argo CD Personal Project

A professional portfolio project showcasing GitOps implementation with Argo CD, Kubernetes, Sealed Secrets, Notifications, and Infrastructure as Code. This project demonstrates DevOps best practices using modern tools and techniques with a security first mindset.

The project uses Terraform to provision Argo CD into a Kind cluster, implements the App of Apps pattern, and leverages Helm charts for application deployment.

contributors last update forks stars open issues license


Table of Contents

Screenshots

argocd_image_updater argocd_apps_page

Tech Stack

ArgoCD Kubernetes Docker Devbox Taskfile gitflow kubectl yq jq yamllint helm terraform k9s kind kubectx

Features

  • Argo CD for Continuous delivery for Kubernetes applications
  • Terraform for Infrastructure as Code
  • Taskfiles for repeatable tasks

Prerequisites

This project uses Devbox to manage the development environment. Devbox provides a consistent, isolated environment with all the necessary tools pre-installed.

Required Tools

  1. install Docker

The rest of the tools are installed using devbox

  1. Install Devbox

  2. Clone the Repository

    git clone https://github.com/sean-njela/argocd-demo.git
    cd argocd-demo
  3. Start the Devbox Environment and poetry environment

    devbox shell # Start the devbox environment (this will also activate the poetry environment)
    poetry install # Install dependencies
    poetry env activate # use the output to activate the poetry environment (ONLY IF DEVBOX DIDNT ACTIVATE IT)
    mkdocs serve # Start the mkdocs server http://127.0.0.1:8000/argocd-demo/

Note - The first time you run devbox shell, it will take a few minutes to install the necessary tools. But after that it will be much faster.

Usage

This project is designed for a simple, one-command setup. All necessary actions are orchestrated through Taskfile.yml.

There are 3 application.yaml files:

  1. 0-application.yaml - This is the dev application.yaml file with app of apps pattern, TF, sealed secrets and helm.
  2. 2-application.yaml - This is the prod application.yaml file with app of apps pattern, TF, sealed secrets and helm.
  3. 3-application.yaml - This is another prod application.yaml file with app of apps pattern, TF, sealed secrets and helm.

πŸš€ Quick Start

To create the local Kubernetes cluster and deploy Argo CD, simply run:

task ssh-keygen 

Then copy the private key to the 0-repo-secret.yaml file for argocd-image-updater. Then copy the public key to the deploy key section in the github repo. Also make sure to add the slack token to the 0-notifications-secret.yaml file. Then run the next command.

task dev

This single command will:

  1. Create a local Kind cluster (if it's not already running).
  2. Deploy Argo CD using the Terraform configuration.
  3. Bootstrap argocd application using 1-sealed-secrets.yaml (this is generated by kubeseal and is the secret argocd will use to update the image in the github repo).
  4. Bootstrap argocd application using 0-application.yaml (this is the application.yaml file with app of apps pattern, TF and helm).
  5. Expose cluster kubeconfig for tools like lens
  6. Add argocd helm repo

or

task prod

This single command will:

  1. Create an EKS cluster (if it's not already running).
  2. Deploy Argo CD using the Terraform configuration.

Then run:

task port-fwd-argocd

You can now access the Argo CD UI at http://localhost:8080 with username admin and for the password run(in a seperate terminal):

task argocd-init-passwd-dev # This will print the password to the terminal for dev
task argocd-init-passwd-prod # This will print the password to the terminal for prod

Then in a seperate terminal window run:

task helm-package-push # This will package the helm chart and push it to the local chartmuseum helm repo

Then run:

task docs # This will serve the docs locally at http://127.0.0.1:8000/argocd-demo/

Use the following command to clean up the cluster and terraform resources:

task cleanup-dev
# or 
task cleanup-prod

This will delete the cluster and terraform resources.

Other Available Commands

To see a full list of all available tasks, run task --list-all

Git Workflow with Git Flow

The Taskfile.gitflow.yml provides a structured Git workflow using Git Flow. This helps in managing features, releases, and hotfixes in a standardized way.

use task -t Taskfile.gitflow.yml --list-all to see all gitflow tasks

Kubernetes Manifests

The environments/dev/k8s directory contains simple Kubernetes manifests for the sample application

The environments/dev/helm directory contains Helm charts for the same application (default in use)

Roadmap

  • ArgoCD implementation
  • Terraform infrastructure as code
  • Helm chart integration
  • App of apps pattern
  • Comprehensive documentation
  • ArgoCD Image Updater
  • Deployment freezing
  • Notification system

NOTES

  • The 1-application.yaml file is the same as the 0-application.yaml it is the file we used initially before we added the app of apps pattern, tf and helm
  • We number the files because we will be adding more and more files in the future
  • With TF we can customise the values of the helm chart on creation. To check which values we can edit, use helm show e.g helm show values argocd/argocd-image-updater > image-updater-values.yaml to check the values. Then specify in a values.yaml in the values folder the values you want to override.
  • SPECIFY A VALUES FILE IN THE TF VALUES FOLDER, ONLY WHEN NECESSARY

Documentation

Comprehensive documentation is available in the docs/ directory. You can view it locally by running:

mkdocs serve # make sure you are in the poetry environment (check prerequisites)

Then navigate to http://127.0.0.1:8000/argocd-demo/

The documentation covers:

  • Project architecture
  • ArgoCD implementation details
  • Application deployment process
  • Environment management
  • Terraform infrastructure
  • Helm chart structure
  • Automation with Task runner

Contributors

Contributions are always welcome!

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Sean Njela - X/twitter - email

Project Link: https://github.com/sean-njela/argocd-demo

About

Argo CD with Terraform, Sealed Secrets, Image Updater, Helm and slack notifications.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published