kubernetes/kops · error

KubernetesPath::CreateFile not supported

Error message

KubernetesPath::CreateFile not supported

What it means

Hard guard: KubernetesPath.CreateFile always returns this error because k8s:// paths are read-only in the VFS abstraction. Unlike cloud-backends, there is no create-with-existence-check flow against the API server here, so any attempt to create a file object through a KubernetesPath fails immediately.

Source

Thrown at util/pkg/vfs/k8sfs.go:98

}

func (p *KubernetesPath) Join(relativePath ...string) Path {
	args := []string{p.key}
	args = append(args, relativePath...)
	joined := path.Join(args...)
	return &KubernetesPath{
		k8sContext: p.k8sContext,
		host:       p.host,
		key:        joined,
	}
}

func (p *KubernetesPath) WriteFile(ctx context.Context, data io.ReadSeeker, acl ACL) error {
	return fmt.Errorf("KubernetesPath::WriteFile not supported")
}

func (p *KubernetesPath) CreateFile(ctx context.Context, data io.ReadSeeker, acl ACL) error {
	return fmt.Errorf("KubernetesPath::CreateFile not supported")
}

// ReadFile implements Path::ReadFile
func (p *KubernetesPath) ReadFile(ctx context.Context) ([]byte, error) {
	var b bytes.Buffer
	_, err := p.WriteTo(&b)
	if err != nil {
		return nil, err
	}
	return b.Bytes(), nil
}

// WriteTo implements io.WriterTo
func (p *KubernetesPath) WriteTo(out io.Writer) (int64, error) {
	return 0, fmt.Errorf("KubernetesPath::WriteTo not supported")
}

func (p *KubernetesPath) ReadDir() ([]Path, error) {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Create the underlying ConfigMap/Secret via the Kubernetes API
  2. Use a writable VFS backend (S3, GCS, memfs) for CreateFile semantics
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at util/pkg/vfs/k8sfs.go:98 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/29e976cc37ace2cb. Report an issue: GitHub.