The Wayback Machine - https://web.archive.org/web/20250607132110/https://github.com/argoproj/argo-cd/issues/7992
Skip to content

Core mode should allow persistent usage of custom K8s client configuration #7992

Open
@jannfis

Description

@jannfis

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 login command should be extended for a --kubeconfig flag 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 --kubeconfig flag is given to Argo CD CLI commands, it should override the default stored in the Argo CD CLI's configuration

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions