Error if --kube-token
and --kube-api-server
set, but ~/.kube/config
doesn't exists
#267
Open
1 task done
Labels
Before proceeding
Version
1.1.1
How to reproduce
Description
When using
nelm
with the--kube-token
and--kube-api-server
flags, the CLI still tries to access the local kubeconfig file. If the kubeconfig is unavailable (e.g., renamed or moved),nelm
fails instead of using the provided token and API server.Steps to Reproduce
Temporarily rename or remove your kubeconfig:
Run the following command (redacted for sensitive information):
Observe the failure due to missing kubeconfig.
Result
nelm
still attempts to read from the default kubeconfig path (e.g.,~/.kube/config
). If this file does not exist, the command fails with the following error:Expected result
When
--kube-token
and--kube-api-server
are provided,nelm
should not attempt to read the default kubeconfig file. It should connect directly using the provided credentials.Additional information
Environment
Additional Context
This behavior prevents using
nelm
in CI/CD environments where no kubeconfig is available and credentials are passed explicitly. It seems the client factory logic does not properly prioritize token/API server parameters over kubeconfig presence.Workaround
Creating an empty kubeconfig file with the correct permissions allows the command to succeed:
However, this is a workaround and not a proper fix. In token-based setups (e.g. CI/CD),
nelm
should be able to run without relying on local configuration.The text was updated successfully, but these errors were encountered: