kubernetes/kops · error
getting pod logs for the current instance of %v/%v: %w
Error message
getting pod logs for the current instance of %v/%v: %w
What it means
Fetching the current container logs failed with a non-400 status error; the log request to the API server failed, e.g. the pod was deleted mid-dump or kubelet could not retrieve the logs.
Source
Thrown at pkg/dump/podlogs.go:123
var statusErr *k8sErrors.StatusError
if errors.As(err, &statusErr) {
if statusErr.ErrStatus.Code != 400 {
podErr = errors.Join(podErr, fmt.Errorf("getting pod logs for the previous instance of %v/%v: %w", pod.Namespace, pod.Name, err))
}
} else {
err := writeContainerLogs(resPath+".previous.log", resp)
if err != nil {
podErr = errors.Join(podErr, err)
}
}
}
{
resp, err := d.k8sClient.CoreV1().Pods(pod.Namespace).GetLogs(pod.Name, &v1.PodLogOptions{Container: container.Name}).Do(ctx).Raw()
var statusErr *k8sErrors.StatusError
if errors.As(err, &statusErr) {
if statusErr.ErrStatus.Code != 400 {
podErr = errors.Join(podErr, fmt.Errorf("getting pod logs for the current instance of %v/%v: %w", pod.Namespace, pod.Name, err))
continue
}
} else {
err := writeContainerLogs(resPath+".log", resp)
if err != nil {
podErr = errors.Join(podErr, err)
}
}
}
}
results <- podLogDumpResult{err: podErr}
}
}
func writeContainerLogs(filePath string, contents []byte) error {
resFile, err := os.Create(filePath)
defer func(resFile *os.File) {View on GitHub (pinned to 4c8573c808)
Solutions
- Check the wrapped API error; NotFound usually means the pod was removed during the dump
- Re-run the dump
- Verify kubelet is healthy on the pod's node
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at pkg/dump/podlogs.go:123 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/98ae7096f50a15b7.
Report an issue: GitHub.