Description
Summary
The Argo CD core mode should allow the user to set a permanent path to a K8s client configuration file, instead of either using ~/.kube/config per default or having to specify --kubeconfig for each command.
Motivation
Some K8s distributions by default install a Kubernetes client CLI (kubectl) which uses a custom path for its configuration. For example, K3s uses /etc/rancher/k3s/k3s.yaml. Every change to a given context therefore modifies this file, instead of ~/.kube/config, which can become confusing in core mode.
Proposal
Argo CD CLI should store the default path to a Kubernetes client config in its own config (i.e. ~/.argocd/config) with the login command, so that other commands in core mode will work out-of-the-box with custom paths, e.g.:
argocd login --core --kubeconfig /etc/rancher/k3s/k3s.yaml
should store the path to the kubeconfig file for that Argo CD CLI context. If it's set in the context, all Argo CD CLI commands in core mode should configure the Kubernetes client from that file, instead of ~/.kube/config, unless --kubeconfig is overriding this path explicitly.
In detail:
- The
argocd logincommand should be extended for a--kubeconfigflag to take the path of a Kubernetes client configuration file - If given, the path should be saved with the context in the Argo CD CLI's configuration file. If not set, the existing default (i.e. `~/.kube/config) should be used.
- If the path to a K8s client configuration is set in the context of Argo CD CLI, it should be used for all commands as default in core mode by default
- If
--kubeconfigflag is given to Argo CD CLI commands, it should override the default stored in the Argo CD CLI's configuration

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
