Manage Argo CD Repositories and Applications using Argo CD CLI
In our last post we have seen how to install Argo CD CLI and demonstrated few Argo CD commands like clusters, context etc. In this post will see how to manage the Repositories and applications in Argo CD using CLI.
As we seen earlier, we can manage repo and apps via UI also, if you wish to manage all the resources via CLI, you can refer this and also this will help you to automate via any CI tool or some automation scripts.
Let’s start with repositories first, as we cannot add the application without repositories it is mandatory.
Prerequisites:
- Azure Kubernetes Service up and running, if you don’t have one, please follow the steps with terraform to create it. How to create Azure Kubernetes Service using Terraform — FoxuTech
- Kubectl installed in the VM or machine you are going to manage the AKS.
- Have a kubeconfig file (default location is ~/.kube/config).
- Argo CD setup. If not, available you can refer Setup ArgoCD on Azure Kubernetes Services — FoxuTech
- Argo CD CLI, installed if not please refer https://foxutech.com/argo-cd-cli-installation-and-commands/
Video Demo
Repositories
argocd repo add
Add git repository connection parameters
# argocd repo add REPOURL [flags]
Examples
Add a Git repository via SSH using a private key for authentication, ignoring the server’s host key:
# argocd repo add git@git.example.com:repos/repo --insecure-ignore-host-key --ssh-private-key-path ~/id_rsa
Add a Git repository via SSH on a non-default port — need to use ssh:// style URLs here
# argocd repo add ssh://git@git.example.com:2222/repos/repo --ssh-private-key-path ~/id_rsa
Add a private Git repository via HTTPS using username/password and TLS client certificates:
# argocd repo add https://git.example.com/repos/repo --username git --password secret --tls-client-cert-path ~/mycert.crt --tls-client-cert-key-path ~/mycert.key
Add a private Git repository via HTTPS using username/password without verifying the server’s TLS certificate
# argocd repo add https://git.example.com/repos/repo --username git --password secret --insecure-skip-server-verification
Add a public Helm repository named ‘stable’ via HTTPS
# argocd repo add https://charts.helm.sh/stable --type helm --name stable
Add a private Helm repository named ‘stable’ via HTTPS
# argocd repo add https://charts.helm.sh/stable --type helm --name stable --username test --password test
Add a private Helm OCI-based repository named ‘stable’ via HTTPS
# argocd repo add helm-oci-registry.cn-zhangjiakou.cr.aliyuncs.com --type helm --name stable --enable-oci --username test --password test
Add a private Git repository on GitHub.com via GitHub App
# argocd repo add https://git.example.com/repos/repo --github-app-id 1 --github-app-installation-id 2 --github-app-private-key-path test.private-key.pem
Add a private Git repository on GitHub Enterprise via GitHub App
# argocd repo add https://ghe.example.com/repos/repo --github-app-id 1 --github-app-installation-id 2 --github-app-private-key-path test.private-key.pem --github-app-enterprise-base-url https://ghe.example.com/api/v3
argocd repo list
List configured repositories
# argocd repo list [flags]
Example:
# argocd repo list
# argocd repo list -o json
# argocd repo list -o yaml
argocd repo get
Get a configured repository by URL
# argocd repo get [flags]
Example
# argocd repo get https://github.com/foxutech/kubernetes.git
# argocd repo get https://github.com/foxutech/kubernetes.git -o json
# argocd repo get https://github.com/foxutech/kubernetes.git -o yaml
argocd repo rm
Remove repository credentials
# argocd repo rm REPO [flags]Example:# argocd repo rm https://github.com/foxutech/kubernetes.git
Applications:
argocd app create
Create an application
# argocd app create APPNAME [flags]
Examples
Continue Reading on Manage Argo CD Repositories and Applications using Argo CD CLI — FoxuTech
You can follow us on social media, to get some short knowledges regularly.
- Facebook: https://www.facebook.com/foxutech/
- Instagram: https://www.instagram.com/foxutech/
- YouTube: Foxutech
- Twitter: https://twitter.com/foxutech
- Medium: FoxuTech — Medium
- BuyMeCoffee: (buymeacoffee.com)