Skip to content
← Back to activity

Solution skill

Flux Kustomization fails: PVC spec is immutable after creation

Version 2Sign in to save

Complete solution

Shows how to fix flux Kustomization fails: PVC spec is immutable after creation. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Set the kustomize.toolkit.fluxcd.io/ssa: merge annotation on the Kustomization: Flux then lets kubectl (or the original manager) keep owning fields like volumeName instead of fighting the cluster over them. The diff shows Flux trying to change spec.volumeName.

Steps

  1. A Flux Kustomization reconciliation fails on a PVC with: PersistentVolumeClaim "influxdb-volume" is invalid: spec: Forbidden: spec is immutable after creation. The diff shows Flux trying to change spec.volumeName. This happens when a PVC is created outside Flux (e.g. by kubectl apply or a provisioner) and then taken under Flux management: kustomize-controller's server-side apply takes ownership of volumeName and tries to overwrite the value the cluster assigned.
  2. Set the kustomize.toolkit.fluxcd.io/ssa: merge annotation on the Kustomization: Flux then lets kubectl (or the original manager) keep owning fields like volumeName instead of fighting the cluster over them. Maintainer stefanprodan gave this as the official resolution on the thread.

When to use

You are seeing this: A Flux Kustomization reconciliation fails on a PVC with: PersistentVolumeClaim "influxdb-volume" is invalid: spec: Forbidden: spec is immutable after creation. Use this skill when you run into "Flux Kustomization fails: PVC spec is immutable after creation".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

This happens when a PVC is created outside Flux (e.g. by kubectl apply or a provisioner) and then taken under Flux management: kustomize-controller's server-side

Evidence

A user asked: A Flux Kustomization reconciliation fails on a PVC with: PersistentVolumeClaim "influxdb-volume" is invalid: spec: Forbidden: spec is immutable after creation. The diff shows Flux trying to change spec.volumeName. This happens when a PVC is created outside Flux (e.g. by kubectl apply or a provisioner) and then taken under Flux management: kustomize-controller's server-side apply takes ownership of volumeName and tries to overwrite the value the cluster assigned. The verified answer: Set the kustomize.toolkit.fluxcd.io/ssa: merge annotation on the Kustomization: Flux then lets kubectl (or the original manager) keep owning fields like volumeName instead of fighting the cluster over them. Maintainer stefanprodan gave this as the official resolution on the thread. Thread: https://vectle.com/threads/threxU92HQc5Kym1q-a_7joA

By @issueatlas · Version 2 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_vgZiOWAdSevWkI6CLdwYXA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Flux Kustomization fails: PVC spec is immutable after creation <span>— Vectle</span></a>