Skip to content

Commit db816e5

Browse files
authored
Merge pull request #48054 from my-git9/pp-10288
improve yaml context for storage/storage-classes.md
2 parents dcd1152 + 9ecafa5 commit db816e5

10 files changed

+124
-132
lines changed

content/en/docs/concepts/storage/storage-classes.md

Lines changed: 11 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -204,28 +204,7 @@ If `nodeName` is used in this case, the scheduler will be bypassed and PVC will
204204
Instead, you can use node selector for `kubernetes.io/hostname`:
205205
{{< /note >}}
206206

207-
```yaml
208-
apiVersion: v1
209-
kind: Pod
210-
metadata:
211-
name: task-pv-pod
212-
spec:
213-
nodeSelector:
214-
kubernetes.io/hostname: kube-01
215-
volumes:
216-
- name: task-pv-storage
217-
persistentVolumeClaim:
218-
claimName: task-pv-claim
219-
containers:
220-
- name: task-pv-container
221-
image: nginx
222-
ports:
223-
- containerPort: 80
224-
name: "http-server"
225-
volumeMounts:
226-
- mountPath: "/usr/share/nginx/html"
227-
name: task-pv-storage
228-
```
207+
{{% code_sample language="yaml" file="storage/storageclass/pod-volume-binding.yaml" %}}
229208

230209
## Allowed topologies
231210

@@ -237,22 +216,7 @@ This example demonstrates how to restrict the topology of provisioned volumes to
237216
zones and should be used as a replacement for the `zone` and `zones` parameters for the
238217
supported plugins.
239218

240-
```yaml
241-
apiVersion: storage.k8s.io/v1
242-
kind: StorageClass
243-
metadata:
244-
name: standard
245-
provisioner: kubernetes.io/example
246-
parameters:
247-
type: pd-standard
248-
volumeBindingMode: WaitForFirstConsumer
249-
allowedTopologies:
250-
- matchLabelExpressions:
251-
- key: topology.kubernetes.io/zone
252-
values:
253-
- us-central-1a
254-
- us-central-1b
255-
```
219+
{{% code_sample language="yaml" file="storage/storageclass/storageclass-topology.yaml" %}}
256220

257221
## Parameters
258222

@@ -278,44 +242,14 @@ The Kubernetes project suggests that you use the [AWS EBS](https://github.com/ku
278242
out-of-tree storage driver instead.
279243

280244
Here is an example StorageClass for the AWS EBS CSI driver:
281-
```yaml
282-
apiVersion: storage.k8s.io/v1
283-
kind: StorageClass
284-
metadata:
285-
name: ebs-sc
286-
provisioner: ebs.csi.aws.com
287-
volumeBindingMode: WaitForFirstConsumer
288-
parameters:
289-
csi.storage.k8s.io/fstype: xfs
290-
type: io1
291-
iopsPerGB: "50"
292-
encrypted: "true"
293-
tagSpecification_1: "key1=value1"
294-
tagSpecification_2: "key2=value2"
295-
allowedTopologies:
296-
- matchLabelExpressions:
297-
- key: topology.ebs.csi.aws.com/zone
298-
values:
299-
- us-east-2c
300-
301-
`tagSpecification`: Tags with this prefix are applied to dynamically provisioned EBS volumes.
302-
303-
```
245+
246+
{{% code_sample language="yaml" file="storage/storageclass/storageclass-aws-ebs.yaml" %}}
247+
304248
### AWS EFS
305249

306250
To configure AWS EFS storage, you can use the out-of-tree [AWS_EFS_CSI_DRIVER](https://github.com/kubernetes-sigs/aws-efs-csi-driver).
307251

308-
```yaml
309-
kind: StorageClass
310-
apiVersion: storage.k8s.io/v1
311-
metadata:
312-
name: efs-sc
313-
provisioner: efs.csi.aws.com
314-
parameters:
315-
provisioningMode: efs-ap
316-
fileSystemId: fs-92107410
317-
directoryPerms: "700"
318-
```
252+
{{% code_sample language="yaml" file="storage/storageclass/storageclass-aws-efs.yaml" %}}
319253

320254
- `provisioningMode`: The type of volume to be provisioned by Amazon EFS. Currently, only access point based provisioning is supported (`efs-ap`).
321255
- `fileSystemId`: The file system under which the access point is created.
@@ -330,17 +264,7 @@ To configure NFS storage, you can use the in-tree driver or the
330264
[NFS CSI driver for Kubernetes](https://github.com/kubernetes-csi/csi-driver-nfs#readme)
331265
(recommended).
332266

333-
```yaml
334-
apiVersion: storage.k8s.io/v1
335-
kind: StorageClass
336-
metadata:
337-
name: example-nfs
338-
provisioner: example.com/external-nfs
339-
parameters:
340-
server: nfs-server.example.com
341-
path: /share
342-
readOnly: "false"
343-
```
267+
{{% code_sample language="yaml" file="storage/storageclass/storageclass-nfs.yaml" %}}
344268

345269
- `server`: Server is the hostname or IP address of the NFS server.
346270
- `path`: Path that is exported by the NFS server.
@@ -450,25 +374,7 @@ This internal provisioner of Ceph RBD is deprecated. Please use
450374
[CephFS RBD CSI driver](https://github.com/ceph/ceph-csi).
451375
{{< /note >}}
452376

453-
```yaml
454-
apiVersion: storage.k8s.io/v1
455-
kind: StorageClass
456-
metadata:
457-
name: fast
458-
provisioner: kubernetes.io/rbd
459-
parameters:
460-
monitors: 10.16.153.105:6789
461-
adminId: kube
462-
adminSecretName: ceph-secret
463-
adminSecretNamespace: kube-system
464-
pool: kube
465-
userId: kube
466-
userSecretName: ceph-secret-user
467-
userSecretNamespace: default
468-
fsType: ext4
469-
imageFormat: "2"
470-
imageFeatures: "layering"
471-
```
377+
{{% code_sample language="yaml" file="storage/storageclass/storageclass-ceph-rbd.yaml" %}}
472378

473379
- `monitors`: Ceph monitors, comma delimited. This parameter is required.
474380
- `adminId`: Ceph client ID that is capable of creating images in the pool.
@@ -512,17 +418,7 @@ storage driver instead.
512418

513419
### Azure File (deprecated) {#azure-file}
514420

515-
```yaml
516-
apiVersion: storage.k8s.io/v1
517-
kind: StorageClass
518-
metadata:
519-
name: azurefile
520-
provisioner: kubernetes.io/azure-file
521-
parameters:
522-
skuName: Standard_LRS
523-
location: eastus
524-
storageAccount: azure_storage_account_name
525-
```
421+
{{% code_sample language="yaml" file="storage/storageclass/storageclass-azure-file.yaml" %}}
526422

527423
- `skuName`: Azure storage account SKU tier. Default is empty.
528424
- `location`: Azure storage account location. Default is empty.
@@ -552,17 +448,7 @@ be read by other users.
552448

553449
### Portworx volume (deprecated) {#portworx-volume}
554450

555-
```yaml
556-
apiVersion: storage.k8s.io/v1
557-
kind: StorageClass
558-
metadata:
559-
name: portworx-io-priority-high
560-
provisioner: kubernetes.io/portworx-volume
561-
parameters:
562-
repl: "1"
563-
snap_interval: "70"
564-
priority_io: "high"
565-
```
451+
{{% code_sample language="yaml" file="storage/storageclass/storageclass-portworx-volume.yaml" %}}
566452

567453
- `fs`: filesystem to be laid out: `none/xfs/ext4` (default: `ext4`).
568454
- `block_size`: block size in Kbytes (default: `32`).
@@ -586,14 +472,7 @@ parameters:
586472

587473
### Local
588474

589-
```yaml
590-
apiVersion: storage.k8s.io/v1
591-
kind: StorageClass
592-
metadata:
593-
name: local-storage
594-
provisioner: kubernetes.io/no-provisioner
595-
volumeBindingMode: WaitForFirstConsumer
596-
```
475+
{{% code_sample language="yaml" file="storage/storageclass/storageclass-local.yaml" %}}
597476

598477
Local volumes do not support dynamic provisioning in Kubernetes {{< skew currentVersion >}};
599478
however a StorageClass should still be created to delay volume binding until a Pod is actually
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: task-pv-pod
5+
spec:
6+
nodeSelector:
7+
kubernetes.io/hostname: kube-01
8+
volumes:
9+
- name: task-pv-storage
10+
persistentVolumeClaim:
11+
claimName: task-pv-claim
12+
containers:
13+
- name: task-pv-container
14+
image: nginx
15+
ports:
16+
- containerPort: 80
17+
name: "http-server"
18+
volumeMounts:
19+
- mountPath: "/usr/share/nginx/html"
20+
name: task-pv-storage
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
apiVersion: storage.k8s.io/v1
2+
kind: StorageClass
3+
metadata:
4+
name: ebs-sc
5+
provisioner: ebs.csi.aws.com
6+
volumeBindingMode: WaitForFirstConsumer
7+
parameters:
8+
csi.storage.k8s.io/fstype: xfs
9+
type: io1
10+
iopsPerGB: "50"
11+
encrypted: "true"
12+
tagSpecification_1: "key1=value1"
13+
tagSpecification_2: "key2=value2"
14+
allowedTopologies:
15+
- matchLabelExpressions:
16+
- key: topology.ebs.csi.aws.com/zone
17+
values:
18+
- us-east-2c
19+
20+
# `tagSpecification`: Tags with this prefix are applied to dynamically provisioned EBS volumes.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
kind: StorageClass
2+
apiVersion: storage.k8s.io/v1
3+
metadata:
4+
name: efs-sc
5+
provisioner: efs.csi.aws.com
6+
parameters:
7+
provisioningMode: efs-ap
8+
fileSystemId: fs-92107410
9+
directoryPerms: "700"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: storage.k8s.io/v1
2+
kind: StorageClass
3+
metadata:
4+
name: azurefile
5+
provisioner: kubernetes.io/azure-file
6+
parameters:
7+
skuName: Standard_LRS
8+
location: eastus
9+
storageAccount: azure_storage_account_name # example value
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apiVersion: storage.k8s.io/v1
2+
kind: StorageClass
3+
metadata:
4+
name: fast
5+
provisioner: kubernetes.io/rbd # This provisioner is deprecated
6+
parameters:
7+
monitors: 198.19.254.105:6789
8+
adminId: kube
9+
adminSecretName: ceph-secret
10+
adminSecretNamespace: kube-system
11+
pool: kube
12+
userId: kube
13+
userSecretName: ceph-secret-user
14+
userSecretNamespace: default
15+
fsType: ext4
16+
imageFormat: "2"
17+
imageFeatures: "layering"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: storage.k8s.io/v1
2+
kind: StorageClass
3+
metadata:
4+
name: local-storage
5+
provisioner: kubernetes.io/no-provisioner # indicates that this StorageClass does not support automatic provisioning
6+
volumeBindingMode: WaitForFirstConsumer
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: storage.k8s.io/v1
2+
kind: StorageClass
3+
metadata:
4+
name: example-nfs
5+
provisioner: example.com/external-nfs
6+
parameters:
7+
server: nfs-server.example.com
8+
path: /share
9+
readOnly: "false"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: storage.k8s.io/v1
2+
kind: StorageClass
3+
metadata:
4+
name: portworx-io-priority-high
5+
provisioner: kubernetes.io/portworx-volume # This provisioner is deprecated
6+
parameters:
7+
repl: "1"
8+
snap_interval: "70"
9+
priority_io: "high"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: storage.k8s.io/v1
2+
kind: StorageClass
3+
metadata:
4+
name: standard
5+
provisioner: example.com/example
6+
parameters:
7+
type: pd-standard
8+
volumeBindingMode: WaitForFirstConsumer
9+
allowedTopologies:
10+
- matchLabelExpressions:
11+
- key: topology.kubernetes.io/zone
12+
values:
13+
- us-central-1a
14+
- us-central-1b

0 commit comments

Comments
 (0)