From 4e3523c0a0f2ee00c5a6e5fd3c708cf3c91bde7e Mon Sep 17 00:00:00 2001 From: iheartNathan Date: Fri, 4 Oct 2024 23:16:34 +0100 Subject: [PATCH] fix inconsistency in documentation of default storageclass --- .../access-authn-authz/admission-controllers.md | 9 ++++++--- .../administer-cluster/change-default-storage-class.md | 10 +++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/content/en/docs/reference/access-authn-authz/admission-controllers.md b/content/en/docs/reference/access-authn-authz/admission-controllers.md index 7e67e94cf0..e915b0b787 100644 --- a/content/en/docs/reference/access-authn-authz/admission-controllers.md +++ b/content/en/docs/reference/access-authn-authz/admission-controllers.md @@ -200,9 +200,12 @@ and automatically adds a default storage class to them. This way, users that do not request any special storage class do not need to care about them at all and they will get the default one. -This admission controller does not do anything when no default storage class is configured. When more than one storage -class is marked as default, it rejects any creation of `PersistentVolumeClaim` with an error and an administrator -must revisit their `StorageClass` objects and mark only one as default. +This admission controller does nothing when no default `StorageClass` exists. When more than one storage +class is marked as default, and you then create a `PersistentVolumeClaim` with no `storageClassName` set, +Kubernetes uses the most recently created default `StorageClass`. +When a `PersistentVolumeClaim` is created with a specified `volumeName`, it remains in a pending state +if the static volume's `storageClassName` does not match the `storageClassName` on the `PersistentVolumeClaim` +after any default StorageClass is applied to it. This admission controller ignores any `PersistentVolumeClaim` updates; it acts only on creation. See [persistent volume](/docs/concepts/storage/persistent-volumes/) documentation about persistent volume claims and diff --git a/content/en/docs/tasks/administer-cluster/change-default-storage-class.md b/content/en/docs/tasks/administer-cluster/change-default-storage-class.md index 26f0cadc6d..732918d338 100644 --- a/content/en/docs/tasks/administer-cluster/change-default-storage-class.md +++ b/content/en/docs/tasks/administer-cluster/change-default-storage-class.md @@ -73,9 +73,13 @@ for details about addon manager and how to disable individual addons. kubectl patch storageclass gold -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}' ``` - Please note that at most one StorageClass can be marked as default. If two - or more of them are marked as default, a `PersistentVolumeClaim` without - `storageClassName` explicitly specified cannot be created. + Please note you can have multiple `StorageClass` marked as default. If more + than one `StorageClass` is marked as default, a `PersistentVolumeClaim` without + an explicitly defined `storageClassName` will be created using the most recently + created default `StorageClass`. + When a `PersistentVolumeClaim` is created with a specified `volumeName`, it remains + in a pending state if the static volume's `storageClassName` does not match the + `StorageClass` on the `PersistentVolumeClaim`. 1. Verify that your chosen StorageClass is default: