amir20/dozzle · error

nodes not found

Error message

nodes not found

What it means

NewK8sClient lists cluster nodes at startup and fails hard when the CoreV1 Nodes API returns an empty list. This means the client connected and authenticated but the cluster reported zero nodes, so Dozzle cannot determine cluster identity and refuses to initialize the k8s client.

Solutions

  1. Verify the kubeconfig/context points at a real, joined cluster (kubectl get nodes).
  2. Check RBAC: a restricted ServiceAccount may list an empty node set; grant nodes list permission.
  3. If running in a namespace-restricted environment, ensure the cluster has registered nodes.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at internal/k8s/client.go:103 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of amir20/dozzle@d9463cbe21 (2026-09-07). Data as JSON: /api/errors/193308cb77ccdc5d. Report an issue: GitHub.

Appendix: source

Thrown at internal/k8s/client.go:103

	clientset, err := kubernetes.NewForConfig(config)
	if err != nil {
		return nil, err
	}
	dynamicClient, err := dynamic.NewForConfig(config)
	if err != nil {
		return nil, err
	}
	discoveryClient, err := discovery.NewDiscoveryClientForConfig(config)
	if err != nil {
		return nil, err
	}

	nodes, err := clientset.CoreV1().Nodes().List(context.Background(), metav1.ListOptions{})
	if err != nil {
		return nil, err
	}
	if len(nodes.Items) == 0 {
		return nil, fmt.Errorf("nodes not found")
	}
	node := nodes.Items[0]

	return &K8sClient{
		Clientset:     clientset,
		DynamicClient: dynamicClient,
		restMapper:    restmapper.NewDeferredDiscoveryRESTMapper(memory.NewMemCacheClient(discoveryClient)),
		namespace:     namespace,
		config:        config,
		host: container.Host{
			ID:   node.Status.NodeInfo.MachineID,
			Name: node.Name,
		},
		ownerCache: make(map[string]ownerLookupResult),
	}, nil
}

type k8sOwner struct {

View on GitHub (pinned to d9463cbe21)