A demo repository that shows CI/CD integration using DroneCI + ArgoCD + Kubernetes.

CI/CD Demo

This is the demo repo for my blog post.

This tutorial shows how to build CI/CD pipeline with DroneCI and ArgoCD. In this demo, we use DroneCI for running tests, publishing new images, and update image tags in the manifest repository. We then use ArgoCD for continuous delivery, synchronizing application states in the Kubernetes cluster with manifests maintained in the Git repository.

This way of doing Kubernetes cluster management and application delivery is kown as GitOps. By applying GitOps, we can maintain a 'source of truth' for both the application code and infrastructure, improving system reliability and efficiency for your team.

Architecture overview:

Prerequisites

  1. A Drone server
  2. A K8s cluster
  3. ArgoCD deployment
  4. A Github account and a Dockerhub account

DroneCI

Setup

After you have connected your Github account with Drone, you can browse all your repositories on Drone dashboard. Next, clone this repo, activate it and navigate to Repositories -> cicd-demo -> settings to add the following secrets:

  • docker_username: your Dockerhub account
  • docker_password: your Dockerhub password
  • git_email: your email
  • git_username: your Github account
  • git_password: your Github password

Finally, replace minghsu0107 with your Github and Dockerhub account in .drone.yml. Now any push or pull request will trigger a Drone pipeline. You can check details via your repo -> setting -> webhook on Github.

Local Development

For local development, you will not want to push every change to your repo just for testing whether .drone.yml works. Instead, you can use Drone CLI to execute pipeline locally.

Login to Drone:

export DRONE_SERVER=<drone-server-url>
export DRONE_TOKEN=<drone-token> # check token under dashboard -> user setting
drone info

For example, you can run step test only by executing the following script under the project root:

drone exec --include=

ArgoCD

Please clone the application manifest repository first. This repo holds the application manifests and will be synced with ArgoCD later. The manifests are maintained by Kustomize, which is supported by ArgoCD out-of-the-box.

If your repository is set to private, you need to configure access credentials on ArgoCD. Otherwise you can skip this step and create new app directly.

Credentials can be configured using Argo CD CLI:

argocd repo add <repo-url> --username <username> --password <password>

Or you can configure via UI. Navigate to Settings/Repositories; click Connect Repo using HTTPS and enter credentials:

You will see something like:

Create new app:

Remember to place the repository with your own repo.

Now we have finish all preparations, and it's time to let the magic happen. Navigate to /applications and click SYNC button on your app in order to synchronize the cluster state:

You can click your app to view details:

As we can see, ArgoCD automatically sync the application to our desired state specified in production base. It also shows how all resources roll out in the cluster. With ArgoCD, we can not only have complete control over the entire application deployment but also track updates to branches, tags, or pinned to a specific version of manifests at a Git commit.

Reference

Owner
Hao-Ming, Hsu
Keep it smart and simple.
Hao-Ming, Hsu
Similar Resources

Kubectl plugin shows pod x node matrix with suitable colors to mitigate troubleshooting effort.

kubectl-pod-node-matrix WORK IN PROGRESS!! This plugin shows pod x node matrix with suitable colors to mitigate troubleshooting effort. Details Troubl

May 11, 2022

Kubernetes OS Server - Kubernetes Extension API server exposing OS configuration like sysctl via Kubernetes API

KOSS is a Extension API Server which exposes OS properties and functionality using Kubernetes API, so it can be accessed using e.g. kubectl. At the moment this is highly experimental and only managing sysctl is supported. To make things actually usable, you must run KOSS binary as root on the machine you will be managing.

May 19, 2021

Automating Kubernetes Rollouts with Argo and Prometheus. Checkout the demo URL below

Automating Kubernetes Rollouts with Argo and Prometheus. Checkout the demo URL below

observe-argo-rollout Demo for Automating and Monitoring Kubernetes Rollouts with Argo and Prometheus Performing Demo The demo can be found on Katacoda

Nov 16, 2022

A kubernetes operator demo generated by code-generator, it only watches cr's events

intro a small operator demo which only watches car cr's events. environment: ubuntu-20.04-amd64 k3s-1.21 docker-20.10.7 go-1.17 tools code-generator d

Dec 13, 2021

GoKubernetes - Demo application for Kubernetes Up and Running

GoKubernetes - Demo application for Kubernetes Up and Running

Demo application for "Kubernetes Up and Running" Running kubectl run --restart=N

Jan 22, 2022

Kubernetes Admission Controller Demo: Validating Webhook for Namespace lifecycle events

Kubernetes Admission Controller Based on How to build a Kubernetes Webhook | Admission controllers Local Kuberbetes cluster # create kubernetes cluste

Feb 27, 2022

A tool that allows you to manage Kubernetes manifests for your services in a Git repository

kuberpult Readme for users About Kuberpult is a tool that allows you to manage Kubernetes manifests for your services in a Git repository and manage t

Dec 16, 2022

Kubernetes controller for backing up public container images to our own registry repository

image-clone-controller Kubernetes controller which watches applications (Deployment and DaemonSet) and "caches" the images (public container images) b

Aug 28, 2022

Mutagen Compose is a modified version of Docker Compose that offers automated integration with Mutagen.

Mutagen Compose Mutagen Compose is a (minimally) modified version of Docker Compose that offers automated integration with Mutagen. This allows you to

Dec 22, 2022
🤖 DroneCI plugin to skip pipelines based on files changes

DroneCI Skip Pipeline ?? DroneCI plugin to skip pipelines based on files changes Motivations This DroneCI plugin enables you skip (or short-circuit) a

Dec 14, 2022
The example shows how to build a simple multi-tier web application using Kubernetes and Docker
The example shows how to build a simple multi-tier web application using Kubernetes and Docker

Guestbook Example This example shows how to build a simple multi-tier web application using Kubernetes and Docker. The application consists of a web f

Nov 15, 2021
Using the Golang search the Marvel Characters. This project is a web based golang application that shows the information of superheroes using Marvel api.
Using the Golang search the Marvel Characters. This project is a web based golang application that shows the information of superheroes using Marvel api.

marvel-universe-web using the Golang search the Marvel Universe Characters About The Project This project is a web based golang application that shows

Oct 10, 2021
False-sharing-demo - Demo for performance effects of CPU cache false-sharing

Example of CPU cache false-sharing in Go. A simple example where 2 integer varia

Aug 28, 2022
Litestream-read-replica-demo - A demo application for running live read replication on fly.io with Litestream

Litestream Read Replica Demo A demo application for running live read replicatio

Oct 18, 2022
Prevent Kubernetes misconfigurations from ever making it (again 😤) to production! The CLI integration provides policy enforcement solution to run automatic checks for rule violations. Docs: https://hub.datree.io
Prevent Kubernetes misconfigurations from ever making it  (again 😤) to production! The CLI integration provides policy enforcement solution to run automatic checks for rule violations.  Docs: https://hub.datree.io

What is Datree? Datree helps to prevent Kubernetes misconfigurations from ever making it to production. The CLI integration can be used locally or in

Jan 1, 2023
Golang Integration Testing Framework For Kong Kubernetes APIs and Controllers.
Golang Integration Testing Framework For Kong Kubernetes APIs and Controllers.

Kong Kubernetes Testing Framework (KTF) Testing framework used by the Kong Kubernetes Team for the Kong Kubernetes Ingress Controller (KIC). Requireme

Dec 20, 2022
TriggerMesh open source event-driven integration platform powered by Kubernetes and Knative.

TriggerMesh open source event-driven integration platform powered by Kubernetes and Knative. TriggerMesh allows you to declaratively define event flows between sources and targets as well as add even filter, splitting and processing using functions.

Dec 30, 2022
A simple Go app and GitHub workflow that shows how to use GitHub Actions to test, build and deploy a Go app to Docker Hub

go-pipeline-demo A repository containing a simple Go app and GitHub workflow that shows how to use GitHub Actions to test, build and deploy a Go app t

Nov 17, 2021
This sample shows how to host multiple Azure functions in Golang.
This sample shows how to host multiple Azure functions in Golang.

azure-function-custom-handler-with-golang This sample shows how to host multiple Azure functions in Golang. To learn more about this sample please che

Dec 26, 2022