-
Notifications
You must be signed in to change notification settings - Fork 368
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OpenEBS is migrated from `spec.extensions.storage` to helm. This is done for consistency with the rest of the documentation and allows to untie the OpenEBS version from the k0s version. This commit makes three changes: 1- Add the corresponding docs changes 2- Deprecate the storage API in kubebuilder 3- Force a panic if OpenEBS is defined as both a helm extension and a storage extension Signed-off-by: Juan-Luis de Sousa-Valadas Castaño <[email protected]>
- Loading branch information
1 parent
697de73
commit 07bb4da
Showing
6 changed files
with
289 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
# OpenEBS | ||
|
||
This tutorial covers the installation of OpenEBS as a helm chart, both from | ||
scratch and how to migrate it to a helm extension. | ||
|
||
## Installing OpenEBS from scratch | ||
|
||
**WARNING**: Do not configure OpenEBS both as a storage extension and helm | ||
extension. Because this is considered an invalid configuration k0s will ignore | ||
the configuration file entirely in order to prevent accidental upgrades or | ||
downgrades. The chart objects defined in the API will still have normal behavior. | ||
|
||
OpenEBS can be installed as a helm chart by adding it as an extension to your configuration: | ||
|
||
```yaml | ||
extensions: | ||
helm: | ||
repositories: | ||
- name: openebs-internal | ||
url: https://openebs.github.io/charts | ||
charts: | ||
- name: openebs | ||
chartname: openebs-internal/openebs | ||
version: "3.9.0" | ||
namespace: openebs | ||
order: 1 | ||
values: | | ||
localprovisioner: | ||
hostpathClass: | ||
enabled: true | ||
isDefaultClass: false | ||
``` | ||
If you want OpenEBS to be your default storage class set `isDefaultClass` to `true`. | ||
|
||
## Migrating bundled OpenEBS to helm extension | ||
|
||
The bundled OpenEBS extension is already a helm extension installed as a | ||
`chart.helm.k0sproject.io` object in the kubernetes apiserver. | ||
|
||
For this reason all we need to do is modifying the storage in the configuration | ||
storage type to `external_storage` instead of `openebs_local_storage`. | ||
|
||
If you are using [dynamic configuration](https://github.com/k0sproject/k0s/pull/3651) you can run this command: | ||
|
||
```shell | ||
kubectl patch clusterconfig -n kube-system k0s --patch '{"spec":{"extensions":{"storage":{"type":"external_storage"}}}}' --type=merge | ||
``` | ||
|
||
If you are using a configuration replace `spec.extensions.storage.type` from | ||
`openebs_local_storage` to `external_storage` in all control plane nodes. | ||
|
||
For clusters configured with a file ratehr than dynamic config it's | ||
advised to make sure that the configuration file is correct, although | ||
it's not required. | ||
|
||
Once the configuration is set to `external_storage` it the object can be | ||
managed as a chart: | ||
|
||
```shell | ||
kubectl get chart -n kube-system k0s-addon-chart-openebs -o yaml | ||
``` | ||
|
||
Once migrated, it's recommended to perform an upgrade to 3.9.0: | ||
|
||
```shell | ||
kubectl patch chart -n kube-system k0s-addon-chart-openebs --patch '{"spec":{"version":"3.9.0"}}' --type=merge | ||
``` | ||
|
||
Optionally, if it's prefered to have the OpenEBS configuration as part of the | ||
cluster configuration, it may be added it to the configuration file or cluster | ||
configuration object following the steps of installing it from scratch. As long | ||
as the values in the file match with the ones in the chart object this will not | ||
trigger any changes. | ||
|
||
## Usage | ||
|
||
Once installed The cluster will have two storage classes available for you to use: | ||
|
||
```shell | ||
k0s kubectl get storageclass | ||
``` | ||
|
||
```shell | ||
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE | ||
openebs-device openebs.io/local Delete WaitForFirstConsumer false 24s | ||
openebs-hostpath openebs.io/local Delete WaitForFirstConsumer false 24s | ||
``` | ||
|
||
The `openebs-hostpath` is the storage class that maps to the `/var/openebs/local` | ||
|
||
The `openebs-device` is not configured and could be configured by [manifest deployer](../manifests.md) accordingly to the [OpenEBS documentation](https://docs.openebs.io/) | ||
|
||
### Example | ||
|
||
Use following manifests as an example of pod with mounted volume: | ||
|
||
```yaml | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: nginx-pvc | ||
namespace: default | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
storageClassName: openebs-hostpath | ||
resources: | ||
requests: | ||
storage: 5Gi | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: nginx | ||
namespace: default | ||
labels: | ||
app: nginx | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: nginx | ||
strategy: | ||
type: Recreate | ||
template: | ||
metadata: | ||
labels: | ||
app: nginx | ||
spec: | ||
containers: | ||
- image: nginx | ||
name: nginx | ||
volumeMounts: | ||
- name: persistent-storage | ||
mountPath: /var/lib/nginx | ||
volumes: | ||
- name: persistent-storage | ||
persistentVolumeClaim: | ||
claimName: nginx-pvc | ||
``` | ||
|
||
```shell | ||
k0s kubectl apply -f nginx.yaml | ||
``` | ||
|
||
```shell | ||
persistentvolumeclaim/nginx-pvc created | ||
deployment.apps/nginx created | ||
bash-5.1# k0s kc get pods | ||
NAME READY STATUS RESTARTS AGE | ||
nginx-d95bcb7db-gzsdt 1/1 Running 0 30s | ||
``` | ||
|
||
```shell | ||
k0s kubectl get pv | ||
``` | ||
|
||
```shell | ||
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE | ||
pvc-9a7fae2d-eb03-42c3-aaa9-1a807d5df12f 5Gi RWO Delete Bound default/nginx-pvc openebs-hostpath 30s | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters