Deploying an application to ArgoCD using Helm— Part 3 of CI/CD using ArgoCD
#10WeeksOfCloudOps
This Blog is Part 3 of the project CI/CD using ArgoCD and Prometheus.
Part 1 is : https://medium.com/@harshaljethwa19/dockerized-the-web-application-part-1-of-ci-cd-using-argocd-331e9036d41e
Part 4 is : https://medium.com/@harshaljethwa19/monitoring-using-prometheus-part-4-of-ci-cd-using-argocd-92e6f6bc84fe
Setups to Deploying an application to ArgoCD:
Setup 1: Check whether Kubernetes is installed or not.
kubectl
kubectl cluster-info
kubectl get pods
Setup 2 : Install Helm and install argoCD CLI and ArgoCD UI using Helm
- Install Helm: Visit the official Helm website (https://helm.sh/) and download the appropriate Helm binary for your operating system. Follow the installation instructions provided for your specific platform.
- Initialize Helm: Once Helm is installed, you need to initialize the Helm client and install Tiller (the Helm server-side component) on your Kubernetes cluster. Run the following command to initialize Helm:
helm init
- This command sets up Helm and installs Tiller in your cluster.
- Verify Helm installation: After initializing Helm, you can verify the installation by running the following command:
helm version
- This command should display the client and server versions of Helm, indicating that Helm is successfully installed and connected to the cluster.
- Add Helm repositories: Helm uses repositories to store and distribute charts (packaged applications). You can add repositories to Helm using the
helm repo add
command. For example:
helm repo add stable https://charts.helm.sh/stable
- This adds the official Helm stable repository to your Helm configuration.
- Search and install charts: With Helm set up, you can search for available charts and install them on your cluster. Use the
helm search
command to find charts and thehelm install
command to install them. For example:
helm search hub nginx
helm install my-nginx stable/nginx
- This searches the Helm Hub for the nginx chart and installs it using the stable/nginx repository.
These steps should get you started with Helm. You can explore further Helm commands and features to deploy, manage, and upgrade applications on your Kubernetes cluster.
Setup 3 : Install argoCD using Helm
Use the below command to install argoCD
helm install argo-cd argo/argo-cd --version 2.1.2
if the above does not work use the below command
helm repo add argo https://argoproj.github.io/argo-helm
helm install argocd argo/argo-cd --version <version>
Once ArgoCD is installed, you can access the ArgoCD UI using the following command:
kubectl port-forward svc/argocd-server -n argocd 8080:443
Open your web browser and navigate to http://localhost:8080
. You will be prompted for login credentials, which you can find using the following command.
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d
Enter the username admin
and the password obtained from the above command to log in to the ArgoCD UI.
Setup 4: Set up Application: In ArgoCD, applications represent your deployments. You need to define an application YAML file to describe your deployment. Here’s an example of an application YAML file (my-app.yaml
):
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: my-app
spec:
project: default
source:
repoURL: https://github.com/HARSHALJETHWA19/Argo-helm
targetRevision: main
path: /charts/
helm:
values: |
replicaCount: 2
service:
port: 8081
targetPort: 8081
destination:
server: https://kubernetes.default.svc
namespace: default
syncPolicy:
automated: {}
replace the Github repo with your one.
- Create Application: Apply the application YAML file to create the application in ArgoCD:
kubectl apply -f my-app.yaml
- This will instruct ArgoCD to monitor the specified repository and deploy the application based on the defined manifests.
- Continuous Deployment: ArgoCD monitors the repository for changes and automatically triggers deployments based on the Git events. Whenever you make changes to the deployment manifests and push them to the repository, ArgoCD will detect the changes and apply them to the cluster.
This Blog is Part 3 of the project CI/CD using ArgoCD and Prometheus.
Part 1 is : https://medium.com/@harshaljethwa19/dockerized-the-web-application-part-1-of-ci-cd-using-argocd-331e9036d41e
Part 4 is : https://medium.com/@harshaljethwa19/monitoring-using-prometheus-part-4-of-ci-cd-using-argocd-92e6f6bc84fe
Follow me :
Linkedin: https://www.linkedin.com/in/harshaljethwa/
GitHub: https://github.com/HARSHALJETHWA19/
Twitter: https://twitter.com/harshaljethwaa
Hashnode: https://harshaljethwa.hashnode.dev/
Thank You!!!