cilium/cilium · error

unable to list same node pods: %w

Error message

unable to list same node pods: %w

What it means

The test lists same-node echo pods by the name=<echoSameNodeDeploymentName> label via the source cluster client to build the sameNode endpoint. This error wraps the ListPods failure with %w. Note that even a successful list with zero pods raises a separate 'unexpected number of same node pods' error — this specific error is purely the API-level failure.

Source

Thrown at cilium-cli/connectivity/check/deployment.go:2976

	}

	for _, pod := range clientPods.Items {
		if strings.Contains(pod.Name, clientCPDeployment) {
			ct.clientCPPods[pod.Name] = Pod{
				K8sClient: ct.client,
				Pod:       pod.DeepCopy(),
			}
		} else {
			ct.clientPods[pod.Name] = Pod{
				K8sClient: ct.client,
				Pod:       pod.DeepCopy(),
			}
		}
	}

	sameNodePods, err := ct.clients.src.ListPods(ctx, ct.params.TestNamespace, metav1.ListOptions{LabelSelector: "name=" + echoSameNodeDeploymentName})
	if err != nil {
		return fmt.Errorf("unable to list same node pods: %w", err)
	}
	sameNodePodItems := k8s.LivePods(sameNodePods.Items)
	if len(sameNodePodItems) != 1 {
		return fmt.Errorf("unexpected number of same node pods: %d", len(sameNodePodItems))
	}
	sameNodePod := Pod{
		Pod: sameNodePodItems[0].DeepCopy(),
	}

	for _, cp := range ct.clientPods {
		err := WaitForPodDNS(ctx, ct, cp, sameNodePod)
		if err != nil {
			return err
		}
	}

	if !ct.params.SingleNode || ct.params.MultiCluster != "" {
		otherNodePods, err := ct.clients.dst.ListPods(ctx, ct.params.TestNamespace, metav1.ListOptions{LabelSelector: "name=" + echoOtherNodeDeploymentName})

View on GitHub (pinned to ac7b90affa)

Solutions

  1. Check the wrapped cause and run kubectl --context <src> -n <TestNamespace> get pods -l name=<echo-same-node>
  2. In multi-cluster runs, verify clustermesh connectivity and the source cluster kubeconfig are valid
  3. Confirm pods list RBAC in the source cluster's test namespace
  4. Re-run the test; if the same-node echo deployment never started, also check its deployment events

Example fix

// before
Error: unable to list same node pods: Get "https://remote-api": x509: certificate has expired
// after
cilium-cli clustermesh status   # verify remote cluster connectivity
# refresh source kubeconfig / renew clustermesh certs, then re-run
Defensive patterns

Strategy: try-catch

Validate before calling

kubectl --context <src> auth can-i list pods -n <TestNamespace>
kubectl --context <src> get ns <TestNamespace>
cilium-cli clustermesh status   # in multi-cluster setups, confirm src connectivity

Try / catch

sameNodePods, err := ct.clients.src.ListPods(ctx, ns, metav1.ListOptions{LabelSelector: "name=" + echoSameNodeDeploymentName})
if err != nil {
    if apierrors.IsNotFound(err) || x509Err(err) || connectionErr(err) {
        return fmt.Errorf("source cluster unreachable/deployment missing: %w", err)
    }
    return fmt.Errorf("same-node pod listing failed: %w", err)
}
if len(sameNodePods.Items) != 1 {
    return fmt.Errorf("expected exactly 1 same-node echo pod, got %d", len(sameNodePods.Items))
}

Prevention

When it happens

Trigger: ct.clients.src.ListPods(ctx, TestNamespace, metav1.ListOptions{LabelSelector: "name=" + echoSameNodeDeploymentName}) returns non-nil: RBAC denial in the source cluster, source cluster API unreachable (common in multi-cluster runs), or namespace deleted.

Common situations: Multi-cluster setups where the source cluster context/token has expired mid-run; clustermesh disconnected so the src client can't reach the remote API; RBAC restricted profiles blocking pod listing.

Related errors


AI-assisted analysis of cilium/cilium@ac7b90affa (2026-08-31). Data as JSON: /api/errors/9e3fd1c28d04313b. Report an issue: GitHub.