Learn to manage a single ArgoCD application declaratively by storing manifests in a Git repository and deploying with kubectl.
In this lesson, you will learn how to manage a single ArgoCD application declaratively. Unlike previous approaches using the ArgoCD CLI or UI, this method involves storing and managing ArgoCD application manifests in a Git repository—just like any other Kubernetes deployment or service manifest.
Within the ArgoCD UI, you define application metadata, source, and destination details. Behind the scenes, this creates a YAML specification that describes the application. Below is an example manifest:
To set up a single ArgoCD application using the declarative approach, follow these steps:
Locate the Repository Directory
In your GitOps ArgoCD repository, find the “MonoApplication” directory. In this example, the application manifest is stored in the “mono-app” directory. For instance, you should see a file named geocentric-app.yml.
Review the YAML Manifest
Below is an excerpt from the geocentric-app.yml file that defines the ArgoCD application. This example includes essential fields such as kind, API version, project, and source details:
This manifest directs ArgoCD to fetch the application manifests from the specified directory, deploy them into the geocentric-model namespace, and enable automated sync with pruning and self-healing capabilities.
Duplicate YAML snippets have been consolidated for clarity. Use the same manifest to ensure consistency across deployments.
Deploy the Application with kubectlFollow these steps to pull the repository into your Kubernetes cluster and create the application:
Clone the repository and navigate to the mono-app folder:
Navigate to the declarative/mono-app/ directory and confirm the contents of the geocentric-app.yml file:
Copy
Ask AI
cd declarative/mono-app/cat geocentric-app.yml
Apply the manifest in the ArgoCD namespace with the following command:
Copy
Ask AI
kubectl -n argocd apply -f geocentric-app.yml
Once applied, you should see the following output indicating success:
Copy
Ask AI
application.argoproj.io/geocentric-model-app created
Verify the Application DeploymentConfirm the application status using both the ArgoCD CLI and kubectl commands:
Copy
Ask AI
argocd app list
This will display the list of applications, including geocentric-model-app.You can also verify its status with:
Copy
Ask AI
kubectl -n argocd get applications
With automated sync enabled, ArgoCD will automatically update the application. Check the ArgoCD UI to verify that both deployment and service resources are correctly deployed.
Access the deployed application via the exposed service NodePort. For example, if the service is exposed on port 30682, you can use that port to access the application’s UI. Here is an example of the service manifest:
In this guide, you’ve learned how to manage a single ArgoCD application declaratively by:
Storing the YAML manifest in a Git repository.
Deploying the application using kubectl.
Verifying application status via both the CLI and the ArgoCD UI.
This declarative approach simplifies application management by integrating GitOps principles, ensuring that your application’s deployment is both reproducible and version-controlled.For more detailed information on Kubernetes deployments and GitOps practices, consider exploring additional resources such as Kubernetes Documentation and ArgoCD Getting Started Guide.