kubernetes-csi-pv-spec-update

Update immutable CSI PersistentVolume specs via kubectl replace --force.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/aldengolab/lorist --skill kubernetes-csi-pv-spec-update
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kubernetes-csi-pv-spec-update
Source: https://github.com/aldengolab/lorist/tree/main/skills/kubernetes-csi-pv-spec-update
Command: npx skills add https://github.com/aldengolab/lorist --skill kubernetes-csi-pv-spec-update

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Update or correct fields in a CSI PersistentVolume spec (e.g., spec.csi.volumeAttributes) that cannot be patched in place because the spec.persistentvolumesource is immutable after creation. The only safe path is to delete and recreate the PV using kubectl replace --force, after removing the pv-protection finalizer and exporting the modified manifest.

Core Features & Use Cases

  • Removes the pv-protection finalizer to allow PV replacement.
  • Exports, edits, and reapplies the PV manifest to update immutable fields such as volumeAttributes.
  • Works for CSI drivers where post-provisioning attribute corrections are needed, and for stale connection info.

Quick Start

Identify the PV to update, remove the pv-protection finalizer, export and edit the PV manifest, then perform a force replace.

Frequently Asked Questions about kubernetes-csi-pv-spec-update

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I update immutable fields in a CSI PersistentVolume spec?

To update immutable fields in a CSI PersistentVolume spec, you must remove the pv-protection finalizer, export the PV manifest, edit the desired fields, and recreate the PV using kubectl replace --force.

Can I patch spec.csi.volumeAttributes on an existing PersistentVolume?

No, you cannot patch spec.csi.volumeAttributes on an existing PersistentVolume because the spec.persistentvolumesource is immutable after creation. You must export, edit, and force replace the PV manifest.

Why do I need to remove the pv-protection finalizer before updating a CSI PV?

You need to remove the pv-protection finalizer before updating a CSI PV because it prevents the PersistentVolume from being deleted, which is a required step to recreate the PV with corrected immutable fields using kubectl replace.

What's the best way to fix stale connection info in a CSI PersistentVolume?

The best way to fix stale connection info in a CSI PersistentVolume is to remove the pv-protection finalizer, export and edit the PV manifest to correct the volumeAttributes, and reapply it using kubectl replace --force.

Does kubectl replace --force cause downtime when updating a CSI PV spec?

kubectl replace --force updates the CSI PV spec by deleting and recreating the PersistentVolume. This process targets the PV object configuration correction without inherent application downtime if the underlying storage volume remains intact.