kubernetes-sigs / cluster-capacity

Cluster capacity analysis
Apache License 2.0
441 stars 103 forks source link

"unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined" #178

Closed yogeek closed 7 months ago

yogeek commented 7 months ago

The tool does not seem to understand the information from the KUBECONFIG

docker run --rm -it --net=host \
  -v $HOME/.kube:/root/.kube \
  -e KUBECONFIG=/root/.kube/kubeconfig.conf \
  -v $HOME/cluster-capacity/pod.yaml:/root/pod.yaml \
  -v $HOME/.asdf/installs/kubectl/1.27.3/bin/kubectl:/usr/local/bin/kubectl \
  docker.io/gofed/cluster-capacity \
  bash

$ cluster-capacity --kubeconfig $KUBECONFIG --default-config /config/default-scheduler.yaml  --podspec /root/pod.yaml
unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined

$ kubectl cluster-info
Kubernetes control plane is running at https://xxxxxx:6443
CoreDNS is running at https://xxxxxx:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
KubeDNSUpstream is running at https://xxxxxx:6443/api/v1/namespaces/kube-system/services/kube-dns-upstream:dns/proxy

if I add --master option (still in the docker container)

$ cluster-capacity --master https://xxxxxx:6443 --kubeconfig $KUBECONFIG --podspec /root/pod.yaml  --default-config /config/default-scheduler.yaml 
Failed to list objects: the server could not find the requested resource (get replicasets.extensions)
yogeek commented 7 months ago

In fact I saw that the docker image pointed in the documentation has not been updated for 4 years apparently... https://hub.docker.com/r/gofed/cluster-capacity

So I am closing this ticket in favor to a new one to ask maintainers to publish docker image automatically in the CI pipeline : #181