{"record":{"id":"3f673213b7837ba5","repo":"amir20/dozzle","slug":"nodes-not-found-3f6732","errorCode":null,"errorMessage":"nodes not found","messagePattern":"nodes not found","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/support/k8s/k8s_cluster_service.go","lineNumber":34,"sourceCode":")\n\ntype K8sClusterService struct {\n\tclient              *K8sClientService\n\ttimeout             time.Duration\n\thosts               []container.Host\n\tnotificationManager *notification.Manager\n\tpersister           *notification.Persister\n}\n\nfunc NewK8sClusterService(client *k8s.K8sClient, timeout time.Duration) (*K8sClusterService, error) {\n\thosts := make([]container.Host, 0)\n\tnodes, err := client.Clientset.CoreV1().Nodes().List(context.Background(), metav1.ListOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(nodes.Items) == 0 {\n\t\treturn nil, fmt.Errorf(\"nodes not found\")\n\t}\n\n\tfor _, node := range nodes.Items {\n\t\thosts = append(hosts, container.Host{\n\t\t\tID:            node.Name,\n\t\t\tName:          node.Name,\n\t\t\tMemTotal:      node.Status.Capacity.Memory().Value(),\n\t\t\tNCPU:          int(node.Status.Capacity.Cpu().Value()),\n\t\t\tDockerVersion: node.Status.NodeInfo.ContainerRuntimeVersion,\n\t\t\tType:          \"k8s\",\n\t\t\tAvailable:     true,\n\t\t})\n\t}\n\n\treturn &K8sClusterService{\n\t\tclient:  NewK8sClientService(client, container.ContainerLabels{}),\n\t\ttimeout: timeout,\n\t\thosts:   hosts,","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/amir20/dozzle/blob/d9463cbe21874e44ab79db6fa63e746ca7d22928/internal/support/k8s/k8s_cluster_service.go#L16-L52","documentation":"`NewK8sClusterService` lists cluster nodes at construction time to build the host list. If the cluster reports zero nodes, service construction fails with 'nodes not found', since Dozzle k8s mode requires at least one node to monitor.","triggerScenarios":"Creating a K8s cluster service against a cluster whose Node list API returns an empty set: RBAC-restricted views, wrong kubeconfig/context pointing at an empty/control-plane-less cluster, or unusual virtual clusters.","commonSituations":"kubeconfig pointing to the wrong context or namespace-scoped credentials that hide nodes; vcluster/kind setups without registered nodes; RBAC denying node listing silently returning empty results in some setups.","solutions":["Verify with `kubectl get nodes` using the same kubeconfig that nodes are visible","Fix RBAC: grant the service account ClusterRole permission to list nodes","Point the kubeconfig at the correct cluster context","Ensure the cluster has registered nodes (check control-plane health)"],"exampleFix":"// before\n# serviceaccount without node list permission\n// after\nkubectl create clusterrolebinding dozzle-nodes --clusterrole=view --serviceaccount=default:dozzle\n# or add a ClusterRole allowing get/list nodes","handlingStrategy":"retry","validationCode":"kubectl get nodes --kubeconfig \"$KUBECONFIG\" | grep -c NAME  # must be > 0 before starting dozzle k8s mode","typeGuard":null,"tryCatchPattern":"svc, err := k8s.NewK8sClusterService(client)\nif err != nil {\n  time.Sleep(5 * time.Second)\n  svc, err = k8s.NewK8sClusterService(client) // retry: nodes may register late\n}","preventionTips":["Validate kubeconfig context and node visibility with kubectl before startup","Grant the service account ClusterRole permissions to list nodes","Wait for cluster readiness in automation before launching dozzle"],"tags":["kubernetes","nodes","initialization"],"backgroundTag":"empty-result-set","analyzedSha":"d9463cbe21874e44ab79db6fa63e746ca7d22928","analyzedAt":"2026-09-07T10:08:55.855Z","contentChangedAt":"2026-09-07T10:08:55.855Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}