Argo CD
Argo CD Installation Steps and Commands
Deploying a Helm chart from Azure Repos or a public GitHub repository with Argo CD involves several steps, including setting up Argo CD in your Kubernetes cluster, connecting it to your repositories, and then deploying your applications using Helm charts. Here's a step-by-step guide to walk you through the process:
1. Install Argo CD in Your Kubernetes Cluster
Create the Argo CD Namespace:
Install Argo CD:
Access Argo CD:
By default, the Argo CD API server is not exposed externally. To access it, use port-forwarding:
The Argo CD UI can then be accessed at
https://localhost:8080
.
Login to Argo CD:
The initial password for the
admin
account is auto-generated. To retrieve it, use:Login using the CLI:
2. Connect Argo CD to Azure Repos and GitHub
Add Azure Repos as a Repository:
Use the Argo CD CLI or UI to add your Azure Repos repository. You’ll need the repository URL and authentication credentials (if it's a private repo).
Add GitHub Repository:
For a public GitHub repository, authentication is not required:
3. Deploy Applications Using Helm Charts
Create an Application in Argo CD:
This can be done via the CLI or the UI. You’ll need to specify the details of your Helm chart. For example:
Sync the Application:
Once the application is created, synchronize it to deploy the Helm chart:
Verify Deployment:
Check the status of your application in Argo CD:
Or view it in the Argo CD UI.
4. Manage and Update Deployments
Update Your Chart: Make changes to your Helm chart in Azure Repos or GitHub. Argo CD will detect these changes and can automatically sync them based on your configuration.
Manual Sync: For manual sync, use the
argocd app sync
command again or use the UI.
Conclusion
Deploying Helm charts from Azure Repos and GitHub using Argo CD provides a powerful way to manage Kubernetes applications declaratively. Argo CD's ability to integrate with different version control systems and automate application deployment and lifecycle management makes it a valuable tool in the GitOps toolkit. Remember to manage your secrets and sensitive data securely when working with public repositories and CI/CD pipelines.
Creating an Argo CD application to deploy a guestbook example using Terraform involves writing a Terraform script that defines the necessary Kubernetes resources. Below is an example Terraform script that creates an Argo CD application for deploying a guestbook application.
Before you start, ensure you have:
Terraform installed and configured.
Access to a Kubernetes cluster with Argo CD installed.
kubectl
configured to interact with your Kubernetes cluster.
Terraform Script to Create an Argo CD Application
First, create a Terraform configuration file (e.g., argo_app.tf
):
Steps to Deploy the Application
Initialize Terraform: Navigate to the directory containing your Terraform script and run:
This command initializes Terraform in the directory.
Apply the Terraform Configuration: Deploy the Argo CD application with:
Confirm the action when prompted. Terraform will create the Argo CD application in your Kubernetes cluster.
Check the Application: Verify that the application is created in Argo CD:
You should see the
guestbook
application listed.
Additional Notes
Namespace: The script assumes that Argo CD is installed in the
argocd
namespace. Adjust accordingly if your setup differs.Sync Policy: The
syncPolicy
is set to not automatically sync. You can change this by settingprune
andselfHeal
totrue
if desired.Provider Configuration: Replace the provider block with your cluster's specific configuration details.
Using Terraform to manage Argo CD applications allows you to treat your deployment configurations as code, enabling versioning, repeatability, and integration into CI/CD pipelines.
References
Last updated
Was this helpful?