Skip to content
View Sapnakamble168's full-sized avatar

Block or report Sapnakamble168

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Maximum 250 characters. Please don't include any personal information such as legal names or email addresses. Markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
Sapnakamble168/README.md

Kubernetes GitOps with ArgoCD

Overview

This project demonstrates the implementation of GitOps using ArgoCD for managing Kubernetes deployments. GitOps ensures that the desired state of a Kubernetes cluster is maintained using version-controlled configurations.

Features

  • Declarative Infrastructure : Manage Kubernetes manifests via Git.
  • Continuous Deployment : Automatically sync application states.
  • Single cluster Management : Deploy and monitor application across single clusters.
  • Automated Syncing : Ensure applications stay in their desired state without manual intervention.

Prerequisites

  • Kubernetes Cluster (Minikube, EKS, GKE, AKS, etc.)
  • ArgoCD installed and configured
  • Git repository with Kubernetes manifests
  • kubectl installed
  • argocd CLI installed
  • Docker installed (if building container images)

Step-by-Step Installation

1. Install minikube

https://minikube.sigs.k8s.io/docs/start/?arch=%2Fmacos%2Farm64%2Fstable%2Fbinary+download

2. Install ArgoCD in Kubernetes

kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml

3. Verify ArgoCD Installation

kubectl get pods -n argocd

Ensure all pods are in Running state:

NAME                                        READY   STATUS    RESTARTS   AGE
argocd-server-7f7b6dbd9b-xxxxx              1/1     Running   0          2m
argocd-repo-server-xxxx                     1/1     Running   0          2m
argocd-dex-server-xxxxx                     1/1     Running   0          2m
argocd-redis-xxxxx                          1/1     Running   0          2m

4. Expose ArgoCD Server (Port-forwarding or Ingress)

Option 1: Port Forwarding (Local Access)

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

Now, access https://localhost:8080 in your browser.

Retrieve the external IP and access ArgoCD via https://<EXTERNAL-IP>.

Option 3: Using Ingress (Recommended for Production)

Apply an ingress resource pointing to the ArgoCD service.


5. Retrieve Initial Admin Password

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

Use this password to log in to the UI or CLI.

6. Login to ArgoCD via CLI

argocd login <ARGOCD-SERVER> --username admin --password <retrieved-password>

7. Register a Git Repository with ArgoCD

argocd repo add <your-git-repo-url>

Ensure your repository contains Kubernetes manifests or Helm charts.

8. Deploy an Application with ArgoCD

argocd app create my-app \
    --repo <your-git-repo-url> \
    --path <k8s-manifest-path> \
    --dest-server https://kubernetes.default.svc \
    --dest-namespace default

9. Sync and Monitor Application

argocd app sync my-app
argocd app get my-app

Check the status of the application:

argocd app list

Automate GitOps Deployment

Enable auto-syncing to ensure ArgoCD automatically applies any changes in the Git repository:

argocd app set my-app --sync-policy automated

Enable pruning and self-healing to remove outdated resources:

argocd app set my-app --sync-policy automated --auto-prune --self-heal

Running the Application

Once deployed, retrieve the service information:

kubectl get svc -n ArgoaCD

If using port-forwarding:

kubectl port-forward svc/my-node-service 9000:80 -n argocd

Now, open http://localhost:9000 in your browser.

Best Practices

  • Keep application configurations in a separate Git repository.
  • Set up automated sync policies for self-healing.
  • Monitor application state with ArgoCD dashboards.

Troubleshooting

Check ArgoCD Logs

kubectl logs -n argocd -l app.kubernetes.io/name=argocd-server

Restart ArgoCD Components

kubectl rollout restart deployment argocd-server -n argocd

Force Resync Application

argocd app sync my-app --force

Debugging Sync Failures

argocd app history my-app
argocd app diff my-app

References


Author

Sapna Kamble Syeda Maseera Tabassum

Popular repositories Loading

  1. linux_commands linux_commands Public

  2. Certificates Certificates Public

  3. html html Public

    CSS

  4. java-tomcat-maven-example java-tomcat-maven-example Public

    Forked from chinnayyachintha/java-tomcat-maven-example

    Example Java + Maven Tomcat application

    Java 1

  5. GitOps GitOps Public

    HTML

  6. distributedfileproject distributedfileproject Public