To Install ArgoCD on Minikube and Deploy Application

To Install ArgoCD on Minikube and Deploy Application

What is Minikube in Kubernetes?

Minikube is a tool that allows you to run a single-node Kubernetes cluster on your local machine, designed for development and testing purposes, providing an easy way to set up a local Kubernetes environment without the need for a full-scale production cluster. Here are some key points about Minikube.

What is Argo CD?

Argo CD is a declarative, GitOps continuous delivery (CD) tool for Kubernetes, and it is part of the Argo Project, a collection of open-source tools for running and managing Kubernetes workloads and applications. Argo CD helps you manage and deploy your Kubernetes applications by syncing your desired application state stored in a Git repository with the actual state in your Kubernetes cluster.

What is GitOps?

GitOps brings the best practices of DevOps, continuous delivery, and version control into infrastructure management, making it easier to deploy, manage, and monitor infrastructure and applications in a reliable and auditable way. By leveraging Git as the single source of truth and automating the deployment process, GitOps improves efficiency, consistency, and collaboration in managing cloud-native applications and infrastructure.

Prerequisites

AWS EC2 Instance: Create an EC2 instance running Ubuntu.

Minimum 2 CPU’s or more

Minimum 2GB of free memory

Minimum 20GB of free disk space

T2.large instance type

SSH Access: Ensure you have SSH access to your EC2 instance.

Basic Linux Knowledge: Familiarity with basic Linux commands will be beneficial.

Launch an instance: Connect to Public IP to server.

In security Group – Edit Inbound Rule with TCP -8080, https - 443

Install Minikube on Ubuntu 22.04 LTS

sudo apt update -y

Install below packages for minikube

sudo apt install curl wget apt-transport-https -y

Install Docker on Ubuntu 22.04 LTS

sudo apt installdocker.io

sudo usermod -aG docker $USER

sudo chmod 666 /var/run/docker.sock

Configure to Run docker without sudo permission.

egrep -q 'vmx|svm' /proc/cpuinfo && echo yes || echo no

To check whether virtualization support is enabled on your machine or not.

Install the KVM and and other tools on Ubuntu

sudo apt install qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virtinst libvirt-daemon

Add your user to libvert group

sudo adduser -a $USER libvirt

sudo adduser -a $USER libvirt-qemu

Reload Group

newgrp libvirt

newgrp libvirt-qemu

To download latest minikube setup refer minikube official download page.

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64

Install Minikube on Ubuntu 22.04 LTS

sudo install minikube-linux-amd64 /usr/local/bin/minikube

To check minikube version on Ubuntu

minikube version

Make the kubectl binary executable

sudo mv kubectl /usr/local/bin/

Install kubectl on Minikube

curl -LO "[dl.k8s.io/release/$(curl](dl.k8s.io/release/$(curl) -L -sdl.k8s.io/release/stable.txt)/bin/linux/amd../bin/linux/amd64/kubectl)"

Download kubectl binary with curl on Ubuntu using below command.

kubectl version --client --output=yaml

Start MiniKube on Ubuntu

To check kubectl version on ubuntu

Start the minikube kubernates cluster on ubuntu.

minikube start --vm-driver docker

To Check the status of Minikube.

minikube status

Install ArgoCD on Minikube

There are several driver options that you can use to start a minikube cluster (virtualbox, docker, hyperv).

We are using driver as docker

minikube start --driver=docker

Just like other kubernates tools, ArgoCD requires a namespace with its name. Therefore, we will create a namespace for argocd.

kubectl create ns argocd

ArgoCD can be installed using its manifests. First, you’ll need to download these manifests and apply them to your Minikube cluster.

kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/v2.5.8/manifests/install.yaml

This will create the necessary resources for ArgoCD within the argocd namespace.

kubectl get all -n argocd

Let’s verify the Installation by getting all the objects in the ArgoCD namespace.

Access ArgoCD UI on Browser

By default, the ArgoCD server is not exposed outside the cluster. You can expose it using port-forwarding to access the ArgoCD UI.

kubectl port-forward svc/argocd-server -n argocd --address 0.0.0.0 8080:443

The ArgoCD UI will be available at http://localhost/IP:8080. Access it through your web browser. Now we can go to a browser and open instance_ip:8080

Now, see a privacy warning. Just ignore the warning, click on Advanced and then hit on Proceed to localhost (unsafe) to continue to the GUI interface.

Get the initial password for the admin user to log in

kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d

Use the generated password to log in as the admin user in the ArgoCD UI.

Deploying an app on ArgoCD

Now that we are on web interface, we can create a new app. The source code for my application is in my Github repo, so We will connect my GitHub repo to ArgoCD.

After logging in, click the + NewApp button.