1111App\Models\Blog Object ( [table:protected] => blogs [fillable:protected] => Array ( [0] => user_id [1] => date [2] => image [3] => title [4] => slug [5] => detail [6] => post_excerpt [7] => status [8] => tags [9] => related_blog_id [10] => category_id [11] => meta_detail [12] => meta_keyword ) [casts:protected] => Array ( [tags] => array ) [connection:protected] => mysql [primaryKey:protected] => id [keyType:protected] => int [incrementing] => 1 [with:protected] => Array ( ) [withCount:protected] => Array ( ) [preventsLazyLoading] => [perPage:protected] => 15 [exists] => 1 [wasRecentlyCreated] => [escapeWhenCastingToString:protected] => [attributes:protected] => Array ( [id] => 65 [user_id] => 4 [category_id] => 1 [title] => Use ArgoCD and GitOps to Deploy DevOps-based Application on Kubernetes [slug] => use-argocd-and-gitops-to-deploy-devops-based-application-on-kubernetes [image] => 1711088747ArgoCD and GitOps to Deploy DevOps-based Application on Kubernetes.webp [date] => 2022-03-23 [detail] =>

Deploying DevOps-based applications or any other application on Kubernetes can benefit in terms of infrastructural advantages, such as scaling, flexibility, distributed component management, and application versioning. In the DevOps development process, continuous integration and deployment (CI/CD) mechanisms often work at a high level of abstraction, offering functionalities like version controlling, logging amendments, and rollback. To deal with this abstraction layer, a popular approach called GitOps comes to the rescue. In this blog, we will use ArgoCD to synchronize and deploy a DevOps-based application stored in the GitHub repository on Kubernetes clusters.

Prerequisites:
Step 1: Install ArgoCD on Kubernetes Cluster
$ kubectl get nodes

This command then will return the list of worker nodes with Ready status to proceed.

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

By default, it shows five pods that have gained the Running state.

Now, you’re all set with ArgoCD in the Kubernetes cluster!

Step 2: Forward Ports to Access ArgoCD

As Kubernetes deploys services by default to arbitrary networks in the cluster, there is a requirement to forward associated ports to grant them access to be able to use them from the respective OS. ArgoCD configures a service called argocd-server on port number 443 internally, but as this port is the default HTTPS one, it is recommended to change it to another port, like 8080.

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

Note: During step 3, you may need to surpass the security warning as ArgoCD has yet to be configured with an SSL certificate.

Step 3: Use Command Line to Work on ArgoCD
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
$ brew install argocd
$ kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo

ArgoCD dashboard

$ argocd login localhost:8080
$ argocd account update-password

Now, you’re all set for using ArgoCD to deploy applications.

Step 4: Manage Multiple Kubernetes Clusters
$ kubectl config get-contexts -o name
$ argocd cluster add target-k8s

Now, additional cluster login credentials are added to ArgoCD, enabling it for deploying services.

Step 5: Deploy Your Application on Kubernetes Cluster

Here, you’ll know the procedures to deploy the application to various Kubernetes clusters. The ArgoCD oversees the management of applications’ source codes, written by considering GitOps fundamentals and stored in GitHub repo. Here, we’re going to deploy a helm-guestbook demo with the Helm chart. You can also consider it as one of the robust Kubernetes management solutions.

$ argocd app create helm-guestbook --repo https://github.com/argoproj/argocd-example-apps.git --path helm-guestbook --dest-server https://kubernetes.default.svc --dest-namespace default
$ argocd app get helm-guestbook

If it returns Sync Status as OutOfSync, consider application status as normal. It also indicates the successful retrieval of the application helm chart from the GitHub repo.

$ argocd app sync helm-guestbook

Here, sync references the deployment of the application under agreement with GitOps principle, aiming to track the application using ArgoCD in the 1:1 collaboration with its upstream configuration. Now, your application is successfully deployed on the Kubernetes cluster using ArgoCD. You can also use the web interface of the ArgoCD application, but the command line makes the process faster and reproducible.

ArgoCD web dashboard view showing application deployment data

$ kubectl port-forward svc/helm-guestbook 9090:80

Application Deployment on Kubernetes using ArgoCD and GitOps (GitHub Repo+DevOps rules) At last, it’ll reflect all new pushes onto the GitHub repo in the ArgoCD, which will continuously resync the application deployment alongside ensuring its high availability.

Conclusion:

As Kubernetes contains many abstraction layers, it is necessary to ensure the maintainability of deployments. And in that case, GitOps principles provide feasible solutions. Have queries related to our DevOps solutions and services? Book your first free 60 mins of DevOps consultation with us TODAY!

[post_excerpt] => Read this blog to know the steps to synchronize and deploy a DevOps-based application stored in the GitHub repository on Kubernetes clusters using ArgoCD. [tags] => [related_blog_id] => 65 [status] => 1 [featured] => 0 [meta_detail] => Read this blog to know the steps to synchronize and deploy a DevOps-based application stored in the GitHub repository on Kubernetes clusters using ArgoCD. [meta_keyword] => [created_at] => 2023-01-10 03:44:50 [updated_at] => 2024-03-22 11:55:47 ) [original:protected] => Array ( [id] => 65 [user_id] => 4 [category_id] => 1 [title] => Use ArgoCD and GitOps to Deploy DevOps-based Application on Kubernetes [slug] => use-argocd-and-gitops-to-deploy-devops-based-application-on-kubernetes [image] => 1711088747ArgoCD and GitOps to Deploy DevOps-based Application on Kubernetes.webp [date] => 2022-03-23 [detail] =>

Deploying DevOps-based applications or any other application on Kubernetes can benefit in terms of infrastructural advantages, such as scaling, flexibility, distributed component management, and application versioning. In the DevOps development process, continuous integration and deployment (CI/CD) mechanisms often work at a high level of abstraction, offering functionalities like version controlling, logging amendments, and rollback. To deal with this abstraction layer, a popular approach called GitOps comes to the rescue. In this blog, we will use ArgoCD to synchronize and deploy a DevOps-based application stored in the GitHub repository on Kubernetes clusters.

Prerequisites:
Step 1: Install ArgoCD on Kubernetes Cluster
$ kubectl get nodes

This command then will return the list of worker nodes with Ready status to proceed.

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

By default, it shows five pods that have gained the Running state.

Now, you’re all set with ArgoCD in the Kubernetes cluster!

Step 2: Forward Ports to Access ArgoCD

As Kubernetes deploys services by default to arbitrary networks in the cluster, there is a requirement to forward associated ports to grant them access to be able to use them from the respective OS. ArgoCD configures a service called argocd-server on port number 443 internally, but as this port is the default HTTPS one, it is recommended to change it to another port, like 8080.

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

Note: During step 3, you may need to surpass the security warning as ArgoCD has yet to be configured with an SSL certificate.

Step 3: Use Command Line to Work on ArgoCD
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
$ brew install argocd
$ kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo

ArgoCD dashboard

$ argocd login localhost:8080
$ argocd account update-password

Now, you’re all set for using ArgoCD to deploy applications.

Step 4: Manage Multiple Kubernetes Clusters
$ kubectl config get-contexts -o name
$ argocd cluster add target-k8s

Now, additional cluster login credentials are added to ArgoCD, enabling it for deploying services.

Step 5: Deploy Your Application on Kubernetes Cluster

Here, you’ll know the procedures to deploy the application to various Kubernetes clusters. The ArgoCD oversees the management of applications’ source codes, written by considering GitOps fundamentals and stored in GitHub repo. Here, we’re going to deploy a helm-guestbook demo with the Helm chart. You can also consider it as one of the robust Kubernetes management solutions.

$ argocd app create helm-guestbook --repo https://github.com/argoproj/argocd-example-apps.git --path helm-guestbook --dest-server https://kubernetes.default.svc --dest-namespace default
$ argocd app get helm-guestbook

If it returns Sync Status as OutOfSync, consider application status as normal. It also indicates the successful retrieval of the application helm chart from the GitHub repo.

$ argocd app sync helm-guestbook

Here, sync references the deployment of the application under agreement with GitOps principle, aiming to track the application using ArgoCD in the 1:1 collaboration with its upstream configuration. Now, your application is successfully deployed on the Kubernetes cluster using ArgoCD. You can also use the web interface of the ArgoCD application, but the command line makes the process faster and reproducible.

ArgoCD web dashboard view showing application deployment data

$ kubectl port-forward svc/helm-guestbook 9090:80

Application Deployment on Kubernetes using ArgoCD and GitOps (GitHub Repo+DevOps rules) At last, it’ll reflect all new pushes onto the GitHub repo in the ArgoCD, which will continuously resync the application deployment alongside ensuring its high availability.

Conclusion:

As Kubernetes contains many abstraction layers, it is necessary to ensure the maintainability of deployments. And in that case, GitOps principles provide feasible solutions. Have queries related to our DevOps solutions and services? Book your first free 60 mins of DevOps consultation with us TODAY!

[post_excerpt] => Read this blog to know the steps to synchronize and deploy a DevOps-based application stored in the GitHub repository on Kubernetes clusters using ArgoCD. [tags] => [related_blog_id] => 65 [status] => 1 [featured] => 0 [meta_detail] => Read this blog to know the steps to synchronize and deploy a DevOps-based application stored in the GitHub repository on Kubernetes clusters using ArgoCD. [meta_keyword] => [created_at] => 2023-01-10 03:44:50 [updated_at] => 2024-03-22 11:55:47 ) [changes:protected] => Array ( ) [classCastCache:protected] => Array ( ) [attributeCastCache:protected] => Array ( ) [dates:protected] => Array ( ) [dateFormat:protected] => [appends:protected] => Array ( ) [dispatchesEvents:protected] => Array ( ) [observables:protected] => Array ( ) [relations:protected] => Array ( ) [touches:protected] => Array ( ) [timestamps] => 1 [hidden:protected] => Array ( ) [visible:protected] => Array ( ) [guarded:protected] => Array ( [0] => * ) )