Add documentation about default storage class
parent
18fb24df44
commit
0eef44d130
|
@ -65,6 +65,7 @@ toc:
|
|||
- docs/tasks/administer-cluster/safely-drain-node.md
|
||||
- docs/tasks/administer-cluster/change-pv-reclaim-policy.md
|
||||
- docs/tasks/administer-cluster/limit-storage-consumption.md
|
||||
- docs/tasks/administer-cluster/change-default-storage-class.md
|
||||
- docs/tasks/administer-cluster/share-configuration.md
|
||||
|
||||
- title: Administering Federation
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
---
|
||||
title: Changing the default StorageClass
|
||||
---
|
||||
|
||||
{% capture overview %}
|
||||
This page shows how to change the default Storage Class that is used to
|
||||
provision volumes for PersistentVolumeClaims that have no special requirements.
|
||||
|
||||
{% endcapture %}
|
||||
|
||||
{% capture prerequisites %}
|
||||
|
||||
{% include task-tutorial-prereqs.md %}
|
||||
|
||||
{% endcapture %}
|
||||
|
||||
{% capture steps %}
|
||||
|
||||
## Why change the default storage class?
|
||||
|
||||
Depending on the installation method, your Kubernetes cluster may be deployed with
|
||||
an existing StorageClass that is marked as default. This default StorageClass
|
||||
is then used to dynamically provision storage for PersistentVolumeClaims
|
||||
that do not require any specific storage class. See
|
||||
[PersistentVolumeClaim documentation](/docs/user-guide/persistent-volumes/#class-1)
|
||||
for details.
|
||||
|
||||
The pre-installed default StorageClass may not fit well with your expected workload;
|
||||
for example, it might provision storage that is too expensive. If this is the case,
|
||||
you can either change the default StorageClass or disable it completely to avoid
|
||||
dynamic provisioning of storage.
|
||||
|
||||
Simply deleting the default StorageClass may not work, as it may be re-created
|
||||
automatically by the addon manager running in your cluster. Please consult the docs for your installation
|
||||
for details about addon manager and how to disable individual addons.
|
||||
|
||||
## Changing the default StorageClass
|
||||
|
||||
1. List the StorageClasses in your cluster:
|
||||
|
||||
kubectl get storageclass
|
||||
|
||||
The output is similar to this:
|
||||
|
||||
NAME TYPE
|
||||
standard (default) kubernetes.io/gce-pd
|
||||
gold kubernetes.io/gce-pd
|
||||
|
||||
The default StorageClass is marked by `(default)`.
|
||||
|
||||
1. Mark the default StorageClass as non-default:
|
||||
|
||||
The default StorageClass has an annotation
|
||||
`storageclass.kubernetes.io/is-default-class` set to `true`. Any other value
|
||||
or absence of the annotation is interpreted as `false`.
|
||||
|
||||
To mark a StorageClass as non-default, you need to change its value to `false`:
|
||||
|
||||
kubectl patch storageclass <your-class-name> -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"false"}}}'
|
||||
|
||||
where `<your-class-name>` is the name of your chosen StorageClass.
|
||||
|
||||
1. Mark a StorageClass as default:
|
||||
|
||||
Similarly to the previous step, you need to add/set the annotation
|
||||
`storageclass.kubernetes.io/is-default-class=true`.
|
||||
|
||||
kubectl patch storageclass <your-class-name> -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, Kubernetes ignores the annotation,
|
||||
i.e. it behaves as if there is no default StorageClass.
|
||||
|
||||
1. Verify that your chosen StorageClass is default:
|
||||
|
||||
kubectl get storageclass
|
||||
|
||||
The output is similar to this:
|
||||
|
||||
NAME TYPE
|
||||
standard kubernetes.io/gce-pd
|
||||
gold (default) kubernetes.io/gce-pd
|
||||
|
||||
{% endcapture %}
|
||||
|
||||
{% capture whatsnext %}
|
||||
* Learn more about [StorageClasses](/docs/user-guide/persistent-volumes/).
|
||||
{% endcapture %}
|
||||
|
||||
{% include templates/task.md %}
|
|
@ -54,6 +54,7 @@ single thing, typically by giving a short sequence of steps.
|
|||
* [Autoscaling the DNS Service in a Cluster](/docs/tasks/administer-cluster/dns-horizontal-autoscaling/)
|
||||
* [Safely Draining a Node while Respecting Application SLOs](/docs/tasks/administer-cluster/safely-drain-node/)
|
||||
* [Changing reclaim policy of a PersistentVolume](/docs/tasks/administer-cluster/change-pv-reclaim-policy/)
|
||||
* [Changing the default StorageClass](/docs/tasks/administer-cluster/change-default-storage-class/)
|
||||
|
||||
#### Managing Stateful Applications
|
||||
|
||||
|
|
|
@ -329,7 +329,7 @@ is turned on.
|
|||
* If the admission plugin is turned on, the administrator may specify a
|
||||
default `StorageClass`. All PVCs that have no `storageClassName` can be bound only to
|
||||
PVs of that default. Specifying a default `StorageClass` is done by setting the
|
||||
annotation `storageclass.beta.kubernetes.io/is-default-class` equal to "true" in
|
||||
annotation `storageclass.kubernetes.io/is-default-class` equal to "true" in
|
||||
a `StorageClass` object. If the administrator does not specify a default, the
|
||||
cluster responds to PVC creation as if the admission plugin were turned off. If
|
||||
more than one default is specified, the admission plugin forbids the creation of
|
||||
|
@ -339,6 +339,9 @@ all PVCs.
|
|||
have no class. In this case, the PVCs that have no `storageClassName` are treated the
|
||||
same way as PVCs that have their `storageClassName` set to `""`.
|
||||
|
||||
Depending on installation method, a default StorageClass may be deployed
|
||||
to Kubernetes cluster by addon manager during installation.
|
||||
|
||||
When a PVC specifies a `selector` in addition to requesting a `StorageClass`,
|
||||
the requirements are ANDed together: only a PV of the requested class and with
|
||||
the requested labels may be bound to the PVC. Note that currently, a PVC with a
|
||||
|
|
Loading…
Reference in New Issue