Kind: Command: kind get nodes / kind get kubeconfig reports "Error: unknown cluster "kind"

Created on 3 Oct 2019  Β·  10Comments  Β·  Source: kubernetes-sigs/kind

Issue

The commands : kind get nodes or kind get kubeconfig outputs Error: unknown cluster "kind"
Version used: v0.5.1

Commands issued

kind create cluster --name halkyon
Creating cluster "halkyon" ...
 βœ“ Ensuring node image (kindest/node:v1.15.3) πŸ–Ό
 βœ“ Preparing nodes πŸ“¦
 βœ“ Creating kubeadm config πŸ“œ
 βœ“ Starting control-plane πŸ•ΉοΈ
 βœ“ Installing CNI πŸ”Œ
 βœ“ Installing StorageClass πŸ’Ύ
Cluster creation complete. You can now use the cluster with:

export KUBECONFIG="$(kind get kubeconfig-path --name="halkyon")"
kubectl cluster-info

and

kind get clusters
halkyon

kind get nodes
Error: unknown cluster "kind"

kind get kubeconfig
Error: unknown cluster "kind"

the docker ps is well started

docker ps
CONTAINER ID        IMAGE                  COMMAND                  CREATED             STATUS              PORTS                                  NAMES
60249751c157        kindest/node:v1.15.3   "/usr/local/bin/entr…"   11 minutes ago      Up 11 minutes       57659/tcp, 127.0.0.1:57659->6443/tcp   halkyon-control-plane
kinbug

All 10 comments

you have to specify the cluster name, otherwise uses kind by default

# kind get nodes --help
lists existing kind nodes by their name

Usage:
  kind get nodes [flags]

Flags:
  -h, --help          help for nodes
      --name string   the cluster context name (default "kind")

Global Flags:
      --loglevel string   logrus log level [panic, fatal, error, warning, info, debug, trace] (default "warning")

try kind get nodes --name "halkyon" and it will work

Then the message displayed should be Error: No nodes found for the cluster - kind instead of Error: unknown cluster "kind" for kind get nodes

Then the message displayed should be Error: No nodes found for the cluster - kind instead of Error: unknown cluster "kind" for kind get nodes

~errors messages can be improved for sure, in this case, kind is assuming that you are asking to list the nodes in a cluster named "kind" , thus the error Error: unknown cluster "kind"~
~Using Error: No nodes found for the cluster - kind can mean that there is currently a cluster named "kind" without nodes, that's not true.~

Anyway, agree with you should use a more descriptive error message

/assign
In master, we've lost the log error

#./kind get nodes --name nonexistantcluster -v3
DEBUG: exec/local.go:88] Running: "docker ps -q -a --no-trunc --filter label=io.k8s.sigs.kind.cluster=nonexistantcluster --format '{{.Names}}'"

not finding nodes is not an error if there are none ... we can improve the message printed though to something like No nodes found for cluster "kind" to stderr

compare to kubectl get.

kind get kubeconfig should absolutely error if it can't obtain the kubeconfig, which requires the control plane nodes.

not finding nodes is not an error if there are none ... we can improve the message printed though to something like No nodes found for cluster "kind" to stderr

but ... what happens if the cluster doesn't exist or never existed? should try to list the nodes too?

but ... what happens if the cluster doesn't exist or never existed? should try to list the nodes too?

yes. this is the same for checking if resources exist with kubectl.

we can't know if the cluster ever existed, and our internal "does this cluster exist" check is just listing nodes ...

Ups, then I have to correct my comment here https://github.com/kubernetes-sigs/kind/issues/915#issuecomment-537946679 , I didn't get it that way

/unassign

this is fixed in HEAD

Was this page helpful?
0 / 5 - 0 ratings