kubernetes/kops · error

creating directory %q: %w

Error message

creating directory %q: %w

What it means

Creating the directory tree under the artifacts dir for one pod's container logs failed; a local filesystem error (permissions, path-too-long, or ENOSPC) on the machine running the dump.

Source

Thrown at pkg/dump/podlogs.go:99

	for i := 0; i < len(allPods.Items); i++ {
		result := <-results
		if result.err != nil {
			dumpErr = errors.Join(dumpErr, result.err)
		}
	}
	return dumpErr
}

func (d *podLogDumper) getPodLogs(ctx context.Context, pods chan v1.Pod, results chan podLogDumpResult) {
	for pod := range pods {
		var podErr error
		for _, container := range append(pod.Spec.InitContainers, pod.Spec.Containers...) {
			resPath := path.Join(d.artifactsDir, "cluster-info", pod.Namespace, pod.Name, container.Name)

			err := os.MkdirAll(path.Dir(resPath), 0755)
			if err != nil {
				podErr = errors.Join(podErr, fmt.Errorf("creating directory %q: %w", resPath, err))
				continue
			}

			{
				resp, err := d.k8sClient.CoreV1().Pods(pod.Namespace).GetLogs(pod.Name, &v1.PodLogOptions{Container: container.Name, Previous: true}).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 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)
					}
				}
			}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Check write permissions and free space in the artifacts directory
  2. Shorten the artifacts dir path if names exceed filesystem limits
  3. Retry after fixing the local filesystem issue
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at pkg/dump/podlogs.go:99 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/1b035b4c5cee75d2. Report an issue: GitHub.