cilium/cilium · error

failed to collect profiling data from Cilium pods: %w

Error message

failed to collect profiling data from Cilium pods: %w

What it means

When c.Options.Profiling is enabled, the sysdump submits gops profiling subtasks against the Cilium agent container on each pod via c.SubmitProfilingGopsSubtasks. Any error from that submission is wrapped with this prefix and returned. It means profiling data could not be collected from the Cilium pods.

Source

Thrown at cilium-cli/sysdump/sysdump.go:1612

		})
	}

	// TODO(#2645): Ideally we would split ciliumTasks into
	// operator, agent, generic tasks, ..., etc
	// and only run then when feasible.
	if c.Options.CiliumNamespace != "" || c.Options.CiliumOperatorNamespace != "" {
		tasks = append(tasks, ciliumTasks...)

		serialTasks = append(serialTasks, Task{
			CreatesSubtasks: true,
			Description:     "Collecting profiling data from Cilium pods",
			Quick:           false,
			Task: func(_ context.Context) error {
				if !c.Options.Profiling {
					return nil
				}
				if err := c.SubmitProfilingGopsSubtasks(c.CiliumPods, ciliumAgentContainerName); err != nil {
					return fmt.Errorf("failed to collect profiling data from Cilium pods: %w", err)
				}
				return nil
			},
		}, Task{
			CreatesSubtasks: true,
			Description:     "Collecting tracing data from Cilium pods",
			Quick:           false,
			Task: func(_ context.Context) error {
				if !c.Options.Tracing {
					return nil
				}
				if err := c.SubmitTracingGopsSubtask(c.CiliumPods, ciliumAgentContainerName); err != nil {
					return fmt.Errorf("failed to collect tracing data from Cilium pods: %w", err)
				}
				return nil
			},
		})
	}

View on GitHub (pinned to ac7b90affa)

Solutions

  1. Ensure Cilium agent pods are Running and exec into them works (kubectl exec -n <ns> <cilium-pod> -c cilium-agent true)
  2. Confirm the cilium image has gops profiling support before passing --profiling
  3. Retry the sysdump once the cluster is healthy
  4. Read the wrapped (%w) cause in the sysdump output for the precise per-pod failure

Example fix

// before
cilium-cli sysdump --profiling   # agents CrashLooping -> exec fails
// after
kubectl -n kube-system rollout status ds/cilium && cilium-cli sysdump --profiling
Defensive patterns

Strategy: try-catch

Validate before calling

if opts.Profiling {
    pods, _ := client.ListPods(ctx, ciliumNs, metav1.ListOptions{LabelSelector: "k8s-app=cilium"})
    for _, p := range pods.Items {
        if p.Status.Phase != corev1.PodRunning {
            return fmt.Errorf("agent pod %s not Running; skip profiling collection", p.Name)
        }
    }
}

Type guard

func isProfilingCollectionErr(err error) bool {
    return err != nil && strings.Contains(err.Error(), "failed to collect profiling data")
}

Try / catch

if err := sysdump.Run(ctx); err != nil {
    if strings.Contains(err.Error(), "failed to collect profiling data") {
        log.Printf("profiling collection failed, continuing without it: %v", unwrapAll(err))
        return nil
    }
    return err
}

Prevention

When it happens

Trigger: c.Options.Profiling == true and c.SubmitProfilingGopsSubtasks(c.CiliumPods, ciliumAgentContainerName) returns an error: empty/invalid pod list, pod exec failures, or the gops agent not accepting profiling requests inside the container.

Common situations: Cilium agent pods not Running or crashing so exec fails; gops profiling not compiled/enabled in the agent image; restricted environments (PSP/OPA) blocking pod exec; running profiling collection against the wrong container name.

Related errors


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