Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add note about storage class defaults #1047

Merged
merged 1 commit into from
Feb 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ When the Pod is deployed, the Kubernetes master will check the PersistentVolumeC
# ]'
```

In particular, starting with v1.4.0, the parameter `mkfsParams` can be used to specify filesystem format options for each StorageClass.
In particular, starting with v1.4.0, the parameter `mkfsParams` can be used to specify filesystem format options for each StorageClass.
Parameters may be omitted from the StorageClass specification. When the storage class is used to create a PV and a volume, parameters that are not specified will generally be set using a default value taken from the global settings. See [here](../../../references/storage-class-parameters) for the list of storage class parameters, and [here](../../../references/settings) for the full list of global settings.

2. Create a Pod that uses Longhorn volumes by running this command:

Expand Down Expand Up @@ -114,7 +115,7 @@ If the PVC names a StorageClass, Kubernetes will:

### Creating Longhorn Volumes with the Longhorn UI

Since the Longhorn volume already exists while creating PV/PVC, a StorageClass is not needed for dynamically provisioning Longhorn volume. However, the field `storageClassName` should be set in PVC/PV, to be used for PVC bounding purpose. And it's unnecessary for users to create the related StorageClass object.
Since the Longhorn volume already exists while creating PV/PVC, a StorageClass is not needed for dynamically provisioning Longhorn volume. However, the field `storageClassName` should be set in PVC/PV, to be used for PVC binding purpose. It's unnecessary for users to create the related StorageClass object.

By default the StorageClass for Longhorn created PV/PVC is `longhorn-static`. Users can modify it in `Setting - General - Default Longhorn Static StorageClass Name` as they need.

Expand Down Expand Up @@ -162,4 +163,4 @@ Annotations: longhorn.io/volume-scheduling-error: insufficient storage

...

```
```
34 changes: 19 additions & 15 deletions content/docs/1.6.0/references/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ For reference, this page provides examples of Kubernetes resources that use Long

### Block Volume


```yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
Expand Down Expand Up @@ -50,11 +50,11 @@ For reference, this page provides examples of Kubernetes resources that use Long
- name: block-vol
persistentVolumeClaim:
claimName: longhorn-block-vol


```

### CSI Persistent Volume

```yaml
apiVersion: v1
kind: PersistentVolume
metadata:
Expand Down Expand Up @@ -115,11 +115,11 @@ For reference, this page provides examples of Kubernetes resources that use Long
- name: vol
persistentVolumeClaim:
claimName: longhorn-vol-pvc

```

### Deployment


```yaml
apiVersion: v1
kind: Service
metadata:
Expand Down Expand Up @@ -186,11 +186,11 @@ For reference, this page provides examples of Kubernetes resources that use Long
- name: mysql-volume
persistentVolumeClaim:
claimName: mysql-pvc

```

### Pod with PersistentVolumeClaim


```yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
Expand Down Expand Up @@ -230,11 +230,13 @@ For reference, this page provides examples of Kubernetes resources that use Long
- name: volv
persistentVolumeClaim:
claimName: longhorn-volv-pvc
```

### Restore to File

For more information about restoring to file, refer to [this section.](../../advanced-resources/data-recovery/recover-without-system)

```yaml
apiVersion: v1
kind: Pod
metadata:
Expand Down Expand Up @@ -283,11 +285,11 @@ For more information about restoring to file, refer to [this section.](../../adv
hostPath:
path: /tmp/restore
restartPolicy: Never

```

### Simple Pod


```yaml
apiVersion: v1
kind: Pod
metadata:
Expand Down Expand Up @@ -315,12 +317,11 @@ For more information about restoring to file, refer to [this section.](../../adv
- name: volv
persistentVolumeClaim:
claimName: longhorn-simple-pvc


```

### Simple PersistentVolumeClaim


```yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
Expand All @@ -332,12 +333,11 @@ For more information about restoring to file, refer to [this section.](../../adv
resources:
requests:
storage: 1Gi


```

### StatefulSet


```yaml
apiVersion: v1
kind: Service
metadata:
Expand Down Expand Up @@ -394,9 +394,11 @@ For more information about restoring to file, refer to [this section.](../../adv
resources:
requests:
storage: 1Gi
```

### StorageClass

```yaml
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
Expand Down Expand Up @@ -428,5 +430,7 @@ For more information about restoring to file, refer to [this section.](../../adv
# }
# ]'

```

Note that Longhorn supports automatic remount only for the workload pod that is managed by a controller (e.g. deployment, statefulset, daemonset, etc...).
See [here](../../high-availability/recover-volume/) for details.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ When the Pod is deployed, the Kubernetes master will check the PersistentVolumeC
# ]'
```

In particular, starting with v1.4.0, the parameter `mkfsParams` can be used to specify filesystem format options for each StorageClass.
In particular, starting with v1.4.0, the parameter `mkfsParams` can be used to specify filesystem format options for each StorageClass.
Parameters may be omitted from the StorageClass specification. When the storage class is used to create a PV and a volume, parameters that are not specified will generally be set using a default value taken from the global settings. See [here](../../../references/storage-class-parameters) for the list of storage class parameters, and [here](../../../references/settings) for the full list of global settings.

2. Create a Pod that uses Longhorn volumes by running this command:

Expand Down Expand Up @@ -114,7 +115,7 @@ If the PVC names a StorageClass, Kubernetes will:

### Creating Longhorn Volumes with the Longhorn UI

Since the Longhorn volume already exists while creating PV/PVC, a StorageClass is not needed for dynamically provisioning Longhorn volume. However, the field `storageClassName` should be set in PVC/PV, to be used for PVC bounding purpose. And it's unnecessary for users to create the related StorageClass object.
Since the Longhorn volume already exists while creating PV/PVC, a StorageClass is not needed for dynamically provisioning Longhorn volume. However, the field `storageClassName` should be set in PVC/PV, to be used for PVC binding purpose. It's unnecessary for users to create the related StorageClass object.

By default the StorageClass for Longhorn created PV/PVC is `longhorn-static`. Users can modify it in `Setting - General - Default Longhorn Static StorageClass Name` as they need.

Expand Down Expand Up @@ -162,4 +163,4 @@ Annotations: longhorn.io/volume-scheduling-error: insufficient storage

...

```
```
21 changes: 21 additions & 0 deletions content/docs/1.6.1/references/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ For reference, this page provides examples of Kubernetes resources that use Long

### Block Volume

```yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
Expand Down Expand Up @@ -50,9 +51,11 @@ For reference, this page provides examples of Kubernetes resources that use Long
- name: block-vol
persistentVolumeClaim:
claimName: longhorn-block-vol
```

### CSI Persistent Volume

```yaml
apiVersion: v1
kind: PersistentVolume
metadata:
Expand Down Expand Up @@ -113,9 +116,11 @@ For reference, this page provides examples of Kubernetes resources that use Long
- name: vol
persistentVolumeClaim:
claimName: longhorn-vol-pvc
```

### Deployment

```yaml
apiVersion: v1
kind: Service
metadata:
Expand Down Expand Up @@ -182,9 +187,11 @@ For reference, this page provides examples of Kubernetes resources that use Long
- name: mysql-volume
persistentVolumeClaim:
claimName: mysql-pvc
```

### Pod with PersistentVolumeClaim

```yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
Expand Down Expand Up @@ -224,12 +231,14 @@ For reference, this page provides examples of Kubernetes resources that use Long
- name: volv
persistentVolumeClaim:
claimName: longhorn-volv-pvc
```

### Pod with Generic Ephemeral Volume

For more information about generic ephemeral volumes, refer to the
[Kubernetes documentation](https://kubernetes.io/docs/concepts/storage/ephemeral-volumes/#generic-ephemeral-volumes).

```yaml
apiVersion: v1
kind: Pod
metadata:
Expand Down Expand Up @@ -264,11 +273,13 @@ For more information about generic ephemeral volumes, refer to the
resources:
requests:
storage: 2Gi
```

### Restore to File

For more information about restoring to file, refer to [this section.](../../advanced-resources/data-recovery/recover-without-system)

```yaml
apiVersion: v1
kind: Pod
metadata:
Expand Down Expand Up @@ -317,9 +328,11 @@ For more information about restoring to file, refer to [this section.](../../adv
hostPath:
path: /tmp/restore
restartPolicy: Never
```

### Simple Pod

```yaml
apiVersion: v1
kind: Pod
metadata:
Expand Down Expand Up @@ -347,9 +360,11 @@ For more information about restoring to file, refer to [this section.](../../adv
- name: volv
persistentVolumeClaim:
claimName: longhorn-simple-pvc
```

### Simple PersistentVolumeClaim

```yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
Expand All @@ -361,9 +376,11 @@ For more information about restoring to file, refer to [this section.](../../adv
resources:
requests:
storage: 1Gi
```

### StatefulSet

```yaml
apiVersion: v1
kind: Service
metadata:
Expand Down Expand Up @@ -420,9 +437,11 @@ For more information about restoring to file, refer to [this section.](../../adv
resources:
requests:
storage: 1Gi
```

### StorageClass

```yaml
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
Expand Down Expand Up @@ -454,5 +473,7 @@ For more information about restoring to file, refer to [this section.](../../adv
# }
# ]'

```

Note that Longhorn supports automatic remount only for the workload pod that is managed by a controller (e.g. deployment, statefulset, daemonset, etc...).
See [here](../../high-availability/recover-volume/) for details.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ When the Pod is deployed, the Kubernetes master will check the PersistentVolumeC
# ]'
```

In particular, starting with v1.4.0, the parameter `mkfsParams` can be used to specify filesystem format options for each StorageClass.
In particular, starting with v1.4.0, the parameter `mkfsParams` can be used to specify filesystem format options for each StorageClass.
Parameters may be omitted from the StorageClass specification. When the storage class is used to create a PV and a volume, parameters that are not specified will generally be set using a default value taken from the global settings. See [here](../../../references/storage-class-parameters) for the list of storage class parameters, and [here](../../../references/settings) for the full list of global settings.

2. Create a Pod that uses Longhorn volumes by running this command:

Expand Down Expand Up @@ -114,7 +115,7 @@ If the PVC names a StorageClass, Kubernetes will:

### Creating Longhorn Volumes with the Longhorn UI

Since the Longhorn volume already exists while creating PV/PVC, a StorageClass is not needed for dynamically provisioning Longhorn volume. However, the field `storageClassName` should be set in PVC/PV, to be used for PVC bounding purpose. And it's unnecessary for users to create the related StorageClass object.
Since the Longhorn volume already exists while creating PV/PVC, a StorageClass is not needed for dynamically provisioning Longhorn volume. However, the field `storageClassName` should be set in PVC/PV, to be used for PVC binding purpose. It's unnecessary for users to create the related StorageClass object.

By default the StorageClass for Longhorn created PV/PVC is `longhorn-static`. Users can modify it in `Setting - General - Default Longhorn Static StorageClass Name` as they need.

Expand Down Expand Up @@ -162,4 +163,4 @@ Annotations: longhorn.io/volume-scheduling-error: insufficient storage

...

```
```
Loading