FATA Install pre-checks failed; could not initialize Kubernetes client; unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined
Describe the bug A clear and concise description of what the bug is.
Environment Provide accurate information about the environment to help us reproduce the issue.
- Trident version: 20.01.1
- Trident installation flags used:./tridentctl install -n trident
- Container runtime: 19.03.6 CE
- Kubernetes version: v1.17.2
- Kubernetes orchestrator:rancher v2.3.5
- Kubernetes enabled feature gates: NA
- OS: centos7.7
- NetApp backend types: ontap
- Other:
- install trident 21.0.1.1 error
FATA Install pre-checks failed; could not initialize Kubernetes client; unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined
and cluster is health & inusing,deploy other function just ok 。
./tridentctl install -n trident --in-cluster=false FATA Install pre-checks failed; could not initialize Kubernetes client; unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined
add executed command in linux server.use kubectl get or create resources is nomally.but use trident command appeared error above
Hi @Wangyegithubv,
When you are upgrading Trident please review the Trident documentation prior to attempting an upgrade. A good starting point is the Upgrading Trident section of the documentation.
sir i just prepare install trident in a new env of k8s.And the new k8s env just the same as other prd k8s env.but when i execute ./tridentctl install ,it shows "FATA Install pre-checks failed; could not initialize Kubernetes client; unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined". the tridentctl can not load the k8s config. and the new k8s cluster could use kubectl nomally.
[k8sadm@k8sdevap01 trident-installer]$ kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 172.27.0.1
It looks like Trident is expecting the environment variables KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT to be set. Make sure these variables are set and try the install again.
Hi @Wangyegithubv,
In addition to what @NA-Scott said you are trying to upgrade from Trident 20.01.1 to Trident 21.01.1. Per the Upgrading Trident documentation you should upgrade to trident 20.07 first.
Hello @Wangyegithubv
Can you confirm that the kubernetes svc is accessible by Trident? Perhaps you are installing Trident as an underprivileged Kubernetes user? Make sure you execute the tridentctl install command as a kube:admin user or a custom defined admin user role
Closing this issue as a response to the request for additional information wasn't provided. This issue can be reopened if it is determined that a problem exists related to the originally reported bug.
I'm experiencing this same issue, when running
./tridentctl install -n trident --kubeconfig /cluster/auth/kubeconfig --debug
DEBU Initialized logging. logLevel=debug
DEBU Trident image: netapp/trident:23.10.0
DEBU Autosupport image: docker.io/netapp/trident-autosupport:23.10
DEBU Creating in-cluster Kubernetes clients. requestID=f93e4f49-34e0-4ea4-947c-d7e550604506 requestSource=Unknown workflow="k8s_client=trace_factory"
FATA Install pre-checks failed; could not initialize Kubernetes client; unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined. Resolve the issue and try again.
I run this from a inside pod which is a worker for Jenkins. At first, I thought it because we have all the KUBERNETES_ set to empty string, but even when I unset them I get this error.
When I copy the kubeconfig locally, and run it from my machine, it works without any extra effort.