Kubernetes Deployments with ARGO CD

Kubernetes Deployments with ARGO CD

Argo CD is an open-source continuous delivery tool for Kubernetes that helps you automate the deployment of your applications to Kubernetes clusters. It provides a declarative way of managing your application manifests in Git repositories and ensures that the desired state of your applications in the Kubernetes cluster matches the state described in your Git repository.

How does Argo CD work?

Argo CD works in a reversed flow mechanism as compared to push-style deployments. The new mechanism enables ArgoCD to run from inside a Kubernetes cluster. Kubernetes faces challenges with the traditional? CD mechanism because CI/CD tools, like Jenkins, sit outside the cluster, whereas Argo CD sits inside the cluster. While inside the cluster, Argo CD pulls changes from git and applies them to the residing cluster. Instead of pushing changes like older generation tools by being inside the cluster, ArgoCD prevents sensitive information from being exposed to other tools outside the Kubernetes cluster and environment.?


Argo CD can be set up in two simple steps.

  1. Deploy the ArgoCD agent to the cluster.
  2. Configure Argo CD to track a Git repository for changes.


When Argo CD monitors change, it automatically applies them to the Kubernetes cluster. When developers commit the new code updates to the Git repository, automated CI pipelines will auto-start the build process and build the container image. Then as per the configurations, the CI pipeline will push and update the Kubernetes manifest files. The pipelines will update the new image version name and details on the deployment.yaml file. Argo CD can track this new update, pull the image, and deploy it onto the target cluster.


When the Kubernetes cluster is ready, Argo CD sends a report about the status of the application and that the synchronization is complete and correct. ArgoCD also works in the other direction, monitoring changes in the Kubernetes cluster and discarding them if they don’t match the current configuration in Git.


Benefits of using Argo CD

  • K8s configurations can be defined as code in the git repository
  • Config files are not applied for individual laptops of developers / DevOps
  • Updates are traceable as tags, branches, or pinned specific manifest versions at Git commits.
  • Same and only interface for updating the cluster.
  • Git as the single source of truth
  • Avoid untrackable kubectl command applications
  • Version-controlled changes with audit trail
  • Single sign-on (SSO) with providers such as GitLab, GitHub, Microsoft, OAuth2, OIDC, LinkedIn, LDAP, and SAML 2.0
  • Support for webhooks triggering actions in GitLab, GitHub, and BitBucket.

Let's start by installing Argo CD

Step 1: To install Argo CD, we must first install Docker and Kubernetes. Let’s put them in one by one. To install docker, run the command

sudo apt-get install docker.i        

then Run the docker version to check whether the docker is installed or not:

Step 2: Let’s install minikube and kubectl, two Kubernetes utilities, after Docker. Minikube can be downloaded using the following methods:

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

Step 3: Instlall minikube using:

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

Step 4: After minikube has been installed, you can start a cluster to install Argo CD. To begin a new cluster, enter the following command:

Step 5: Now, let’s Install Argo CD using HELM. Run the following commands to install helm in your system:

curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3        
chmod 700 get_helm.sh        
./get_helm.sh        

Step 6: Run the following commands to download and install Argo CD in your system:

git clone https://github.com/argoproj/argo-helm.git        
cd argo-helm/charts/argo-cd/        
kubectl create ns myargo        
helm dependency up        
helm install myargo . -f values.yaml -n myargo        
kubectl port-forward service/myargo-argocd-server 8090:80 -n myargo –address 0.0.0.0        

Step 7: Now go to localhost:8080 or remoteip:8080 to access the UI of Argo CD.

Step 8: To generate a password, execute the following command. The administrator username is the default.

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


Congratulations! Argo CD has been successfully installed on your system.

I wrote the following code in the application.yaml file:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: myapp-argo-application
  namespace: argocd
spec:
  project: default

  source:
    repoURL: https://gitlab.com/nanuchi/argocd-app-config.git
    targetRevision: HEAD
    path: dev
  destination: 
    server: https://kubernetes.default.svc
    namespace: myapp

  syncPolicy:
    syncOptions:
    - CreateNamespace=true

    automated:
      selfHeal: true
      prune: true        

Step 9: Apply the configuration file with kubectl apply -f application.yaml and you should get the following screen:

Conculsion

Argo CD simplifies Kubernetes application deployment through GitOps, promoting automation and consistency while offering robust management capabilities for cloud-native environments.

要查看或添加评论,请登录

Alice Sophiya Samuel的更多文章

  • Basic (Beginner) ways to make a budget Infra

    Basic (Beginner) ways to make a budget Infra

    When a client uses resources without limits, I suggested some AWS changes to optimize costs. Now, they're saving .

  • KUBERNETES - THE FUTURE OF LINUX

    KUBERNETES - THE FUTURE OF LINUX

    Kubernetes doesn’t replace Linux; it extends it by providing a layer of abstraction that allows organizations to scale…

  • OPENSHIFT DEPOLYMENTS

    OPENSHIFT DEPOLYMENTS

    What is OpenShift Deployment? An OpenShift Deployment is a resource object that provides declarative updates to…

  • Forecasting Infrastructure Trends: Cloud vs. Bare Metal

    Forecasting Infrastructure Trends: Cloud vs. Bare Metal

    Navigating between the tailored control of private data centers (bare metal) and the expansive versatility of cloud…

  • Easy Understanding of Kubernetes Architecture with Real world Examples

    Easy Understanding of Kubernetes Architecture with Real world Examples

    Kubernetes, often abbreviated as K8s, is an open-source container orchestration platform designed to automate the…

  • Kubernates - Case Study on Industries

    Kubernates - Case Study on Industries

    In today's rapidly evolving digital landscape, businesses are constantly challenged to adapt and innovate. As the…

  • AWS FARGATE

    AWS FARGATE

    AWS Fargate: Serverless compute for containers AWS Fargate is a serverless compute engine for containers that enables…

  • Apache Kafka to the Kubernetes Era!

    Apache Kafka to the Kubernetes Era!

    Here, it get back to back updates with the red hat that seems the most rapid speed of new era started with kubernetes .…

  • KERBEROS

    KERBEROS

    It's always used to say that old is gold , here the tech field moves to the faster miles , It felt to be embracing when…

  • WHERE DOES THE IP HAVE COME FROM?

    WHERE DOES THE IP HAVE COME FROM?

    Our daily lives involved IP addresses. In the modern era, every smart device on the network is identifiable by its IP…

社区洞察

其他会员也浏览了