How to add new cluster in ArgoCD use config file of Rancher? - the server has asked for the client to provide credentials
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
When ArgoCD says the server asked for the client to provide credentials while you are using a Rancher-generated kubeconfig, the usual problem is that the kubeconfig contains Rancher-specific or short-lived authentication details that ArgoCD cannot use as a stable cluster credential. ArgoCD works best with a direct Kubernetes API server address plus a token or certificate-based credential it can store and reuse.
Understand Why the Rancher Kubeconfig Can Fail
A Rancher kubeconfig often works interactively with kubectl for a human operator, but that does not mean it is a good credential source for ArgoCD.
Common failure modes include:
- exec-based authentication helpers
- Rancher proxy endpoints rather than direct cluster API endpoints
- short-lived tokens
- credentials tied to a user session rather than a service account
ArgoCD needs something automation-friendly, not just something a human CLI session can consume once.
Prefer a Direct Cluster Credential for ArgoCD
The robust pattern is to give ArgoCD credentials that target the downstream cluster directly, typically with:
- cluster API server URL
- CA certificate
- service-account token or certificate-based auth
That is much more reliable than importing a Rancher user kubeconfig unchanged.
Use a Service Account with the Required Permissions
A common fix is to create or use a service account in the target cluster and let ArgoCD use that token.
Once that credential exists, add the cluster through ArgoCD with a kubeconfig or secret that contains the direct server, CA data, and token.
This makes the authentication model explicit and avoids hidden Rancher mediation details that ArgoCD may not handle the way kubectl does.
Test the Credential Outside ArgoCD First
Before blaming ArgoCD, verify that the exact kubeconfig or token can access the target cluster non-interactively.
That means testing with a clean kubectl invocation that does not rely on your interactive Rancher session. If that non-interactive test fails, ArgoCD will fail too.
Common Pitfalls
- Assuming a Rancher user kubeconfig is automatically suitable for ArgoCD automation.
- Importing a config that relies on interactive or short-lived credentials.
- Pointing ArgoCD at a Rancher-mediated endpoint without understanding the auth flow.
- Using a human user credential instead of a cluster service-account style credential for GitOps automation.
- Skipping standalone
kubectlvalidation of the exact non-interactive credential.
Summary
- This error usually means ArgoCD does not have a stable direct credential it can use for the target cluster.
- Rancher-generated kubeconfigs may work for humans but fail for GitOps automation.
- Prefer a direct cluster API endpoint with service-account or other automation-safe credentials.
- Validate the credential non-interactively before adding it to ArgoCD.
- ArgoCD cluster auth should be explicit, durable, and automation-friendly.

