Working with argoCD and microk8s
Background:
Today, I will be going to demonstrate the concept of deploying application on microk8s using argoCD. As most of us are aware that argoCD is a pull based CICD framework which listens to GIT repository continuously/partially. Once the changes to GIT repository is been made – it will automatically detects the changes and deploy things to microk8s.. Microk8s is like Minikube which is popular as a local container orchestration tool which is used by most of the DevOps engineers. Microk8s is CNCF-certified distribution and it’s built by Kubernetes team at Canonical....
Now since we got the background, let’s jump into a quick lab.
For the sake of simplicity and understanding, let’s try to create simple Nginx application and deploy it to Microk8s cluster. Let’s try to divide this experiment into 3 steps..
Now let’s go into each step one by one!
Setup microk8s with basic steps.
Official documentation of microk8s helps you to install it on desired machine.. I personally used windows OS for this experiment. Once the microk8s is installed you can check it’s installation with below commands.
microk8s status
microk8s kubernetes get nodes
It will show the list of available nodes. (Observe that kubernetes command is written in front of microk8s word.) You can set the context of microk8s by updating the config file of Kubernetes. I.e which is at ~/.kube/config.
microk8s config view
Above command is used to show the config of a cluster. If you have the ~/.config file already, you can add the new context in it. In this way, you will be able interact with cluster using kubectl syntax.
Recommended by LinkedIn
Manage Kubernetes deployment YAML files
Let’s create a sample GITHUB repository and create ssh file. So that we should be able to clone the repository... For the sake of simplicity, we will be going to add simple NGINX deployment and service YAML at the root location of this repository. This repository will be linked to argoCD which will pull the latest changes and deploy stuffs to our microk8s cluster. I have created a sample repository here. You can use it for testing purpose.
Deploying argoCD in a separate namespace of a cluster and try auto deploy YAML code to a cluster.
Let’s assume you deployed microk8s to a separate namespace, we will be able to visualize it’s UI by port forwarding the deployment of argoCD. Check the below command..
kubectl port-forward svc/argocd-server -n <namespace> 8080:443
If we create an application with auto sync ON then whatever changes we added to our GIT repository will be automatically get's deployed to microk8s and dashboard looks like this way..
Note: This is an introductory article.. This will help you to understand the basics of making deployment working using argo and microk8s.