ArgoCD for Continuous Delivery/Deployment
Introduction:
ArgoCD is a powerful continuous delivery tool that allows you to deploy the applications and configurations to Kubernetes clusters with ease. Here we will go through the steps to install and configure ArgoCD in an Amazon Web Services (AWS) Elastic Kubernetes Service (EKS) cluster.
Prerequisites:
1.An AWS EKS cluster should be set up and in the running state.
2.kubectl installed and configured to connect to the EKS cluster.
3.Helm 3 installed.
Why Argo CD?
It allows the teams to achieve?GitOps, which has the following principles:
1.Automated Deployment: ArgoCD automates the deployment process of applications, ensuring that the Kubernetes cluster is always up-to-date with the latest changes in your Git repository.
2.Rollbacks and Revisions: ArgoCD supports rollbacks and revisions, allowing you to quickly and easily revert to a previous version of your application in case of issues or errors.
3.Monitoring: ArgoCD provides built-in monitoring and alerting capabilities, making it easier to keep track of the health and status of the applications.
Flow diagram:
Complete CI/CD flow, CI with jenkins and CD with Argo:
2.ArgoCD configuration for the deployment for custom Applications:
Open the link and Click on Install.
Steps:
1.Add helm repository:
>helm repo add argo https://argoproj.github.io/argo-helm
2.Install/pull, download the helm chart:
>mkdir argo
>cd argo
helm chart creation for custom installation
>helm pull argo/argo-cd --version 5.50.1 ??
Extract it:
>tar -zxvf? argo-cd-5.50.1.tgzx??
?Updates in values.yaml file as below for customization:
ingress:
enabled: true
className: "nginx"
annotations: {}
hosts:
- argocd.edshopper.com
values.yaml
nginx:
deployment:
name: nginx
image:
name: nginx
tag: 1.25
replicas: 1
port: 80
prometheus:
replicaCount: 1
image:
repository: prom/prometheus
pullPolicy: IfNotPresent
tag: "latest"
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
serviceAccount:
create: true
annotations: {}
name: ""
podAnnotations: {}
podSecurityContext: {}
securityContext: {}
service:
type: NodePort
port: 9090
ingress:
enabled: true
className: "nginx"
annotations: {}
hosts:
- host: argocd.edshopper.com
paths:
- path: /
pathType: ImplementationSpecific
tls: []
resources: {}
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 100
targetCPUUtilizationPercentage: 80
nodeSelector: {}
tolerations: {}
affinity: {}
grafana:
replicaCount: 1
image:
repository: grafana/grafana
pullPolicy: IfNotPresent
tag: "latest"
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
serviceAccount:
create: true
annotations: {}
name: ""
podAnnotations: {}
podSecurityContext: {}
securityContext: {}
service:
type: NodePort
port: 3000
ingress:
enabled: true
className: "nginx"
annotations: {}
hosts:
- host: argocd.edshopper.com
paths:
- path: /
pathType: ImplementationSpecific
tls: []
resources:
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 100m
memory: 128Mi
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 100
targetCPUUtilizationPercentage: 80
nodeSelector: {}
tolerations: {}
affinity: {}
install Argocd:
$ helm install argocd -f values.yaml . ?-n argocd --create-namespace
Resolute the argocd server endpoint in Route53 for external access.
As cname records.
$ kubectl get ingress -n argocd ?????:to get the server endpoint to resolute in Route53.
Configure the Port forward for external access:
领英推è
$ kubectl port-forward service/argocd-server –n argocd 8080:443
Get the default PW for Argocd login:
Default User name:? Admin
Get the default PW from the below cmd for argo login home page:
$ kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath =â€{.data.password}†| base64 -d
Settings in ArgoCD:
Settings----Repositories----connect repo
To inter-connect ArgoCD with BitBucket follow the below config:
Go to BitBucket and create a Repo: "Argo-k8s-demo"? to store the helm charts,
Create an App password to connect with BitBucket.
Go to ArgoCD-----Connect Repo---
Do the below settings in ArgoCD-----enter the data to access the Repo
Connection Method: https
Git
Project: default
Provide Bit Bucket Repo URL ?of Repo and test the connection
User Name: Bit Bucket username
PW: BB login PW.
Test the Connectivity with BB/Git
Create an Application by using manifest file.
Create a namespace: dev
$ kubectl create ns dev
"The environment name where the application would deployed is specified in argo-app manifest file as defined below"
Create the argo-app.yaml:
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: eos
namespace: argocd
spec:
project: default
source:
repoURL: git clone https://xyz@bitbucket.org/edwikieos/eos-platform-repo.git
targetRevision: HEAD #master branch
path: eos/nginx
helm:
valueFiles:
- values.yaml
destination: # where to deplooy application
server: https://kubernetes.default.svc # since Argo & kubernetes cluster are running in same cluster
namespace: dev
syncPolicy:
syncOptions:
- CreateNamespace=true
automated:
selfHeal: true
prune: true
Deploy the application:
$ kubectl apply -f argo-app.yaml
Go to Argo app and verify app deployment:
Push the helm chart to BitBucket Repository for the deployment in kubernetes:
whenever the developer push the helm chart to Git/Bit Bucket Repository Argo get triggered and automatically deploy to the kubernetes.