Deploy software on Kubernetes with argoCD
updated: 2024-02-01
Once you have a kubernetes environment running, a tool like argoCD can help you manage applications that you want to deploy on kubernetes. ArgoCD expects a pattern of using git repositories as the source of truth for defining the state of your applications. You can communicate with the kubernetes API by submitting requests in YAML or JSON format. I am going to be focusing on managing applications with helm charts.
ArgoCD automates the deployment of applications in kubernetes. Application deployments can track updates to git branches, tags, or pinned to a specific version of manifests at a specific commit.
ArgoCD installs to a kubernetes cluster and continuously monitors running applications and compares with the state of the configured git repositories.
Try argoCD
You can try argoCD in any kubernetes environment including dev environments such as minikube. If you are not familiar with kubernetes, check out a previous post about getting started with kubernetes.
Quick install
To install argo, create the specified namespace and apply the latest version of the argoCD deployment manifest.
|
|
Production install
Outside of a dev environment, you want to manage the state of argoCD application in a declarative manner similar to how argoCD is managing the state of your applications.
ArgoCD will be installed using a helm
chart.
You will need access to your own kubernetes cluster and the helm CLI installed on your machine.
Installing helm
Helm is available on package manager for several operating systems. For the latest release, you can also download pre-compiled binaries on the GitHub release page:
https://github.com/helm/helm/releases
Install on macOS
You can install helm using brew
on macOS:
|
|
Install on windows
You can install helm on windows using the Chocolatey package manager. If you are not familiar with Chocolatey, check out a previous post
|
|
Install on fedora linux
On Fedora, you can install from the fedora repositories using the dnf
package manager:
|
|
Install argoCD helm chart
Once you have the helm
binary installed, add the argoCD helm repository and install the argoCD chart:
|
|
Then:
|
|
You can customize the deployment with a values.yaml
file. For example to deploy in a HA configuration:
|
|
To install with the values file:
|
|
Deploying a helm application with argocd
Here is an example of how to manage an application deployed using a helm chart with argoCD. You can store this in a git repository and apply it to a cluster with argoCD installed.
argo-example-helm.yaml
|
|
This manifest uses the api added by argoCD to deploy a argo Application object in the argocd
namespace. The example above will install an application that will provision Persistent Volume objects using partitions on the kubernetes worker nodes.
Deploy the application to your cluster using kubectl
if you do not have this tool, check out a previous post to find out where to get it.
|
|
You can see resources deployed in your cluster:
|
|
See argo applications by searching for the custom resource:
|
|
Once argoCD has completed deploying an application the previous command should show the name of the application along with the sync and health status:
|
|
Next steps
After you have deployed argoCD, you can access argo using the CLI or the web UI.
There is an initial admin token created to interact with argoCD:
|
|
You are looking for argocd-initial-admin-secret
.
|
|
This token can be used with the built-in admin
user to access the UI or CLI.
Argo UI
You can access the UI by port forwarding the connecting with kubectl
|
|
You are looking for the service argocd-server
.
|
|
That will make the argoCD UI available on your localhost
port 4443
.
Access the UI in the browser via https://localhost:4443
and accept the warning about a self-signed certificate. The proxy will be active until you press
Clean up
You can remove argoCD from your kubernetes cluster by removing the argoCD
namespace.
|
|