OpenEBS Deployment¶
Introduction¶
Kubernetes local persistent volumes allow users to access local storage in a simple and portable way through the standard PVC interface. PVs contain node affinity information, which the system uses to schedule pods to the correct nodes.
OpenEBS Dynamic Local PV extends the functionality provided by Kubernetes local PVs by using the OpenEBS Node Storage Disk Manager (NDM). The main differences include:
- Users do not need to pre-format and mount devices in the nodes.
- Dynamic local PVs are supported, where devices can be used by CAS solutions and applications. CAS solutions typically access devices directly. By using blockdeviceclaims supported by OpenEBS NDM, OpenEBS Local PV simplifies the management of storage devices used between CAS solutions (direct access) and applications (via PV).
- Support for providing local PVs using hostpath. In fact, in some cases, Kubernetes nodes may have only a limited number of storage devices attached, while hostpath-based local PVs provide efficient management of the available storage on the node.
Prerequisites¶
- A Kubernetes cluster must be deployed. If not, refer to Kubernetes Deployment.
- (Optional) Helm must be deployed. If not, refer to Helm Installation.
Basic Information and Compatibility¶
| Name | Version | Offline Deployment Support | Supported Architectures | Supported Cluster Versions |
|---|---|---|---|---|
| localpv-provisioner | 2.0 | Yes | amd64/arm64 | 1.18+ |
Deployment Steps¶
1. Installation¶
Run the following command to install:
helm install localpv localpv-provisioner --repo https://pubrepo.guance.com/chartrepo/dataflux-chart -n kube-system
Output:
NAME: localpv
LAST DEPLOYED: Wed Nov 2 12:44:53 2022
NAMESPACE: kube-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
The OpenEBS Dynamic LocalPV Provisioner has been installed.
Check its status by running:
$ kubectl get pods -n kube-system
Use `kubectl get bd -n kube-system` to list the
blockdevices attached to the Kubernetes cluster nodes.
Get started with the Dynamic LocalPV Provisioner Quickstart guide at:
https://github.com/openebs/dynamic-localpv-provisioner/blob/develop/docs/quickstart.md
For more information, visit our Slack at https://openebs.io/community or view
the OpenEBS documentation online at https://openebs.io/docs
STATUS: deployedindicates successful deployment.
2. Verify Deployment¶
2.1 Check Pod Status¶
Output:
NAME READY STATUS RESTARTS AGE
localpv-localpv-provisioner-c7dd598dc-wtrgg 1/1 Running 0 27m
localpv-openebs-ndm-65987 1/1 Running 0 27m
localpv-openebs-ndm-6h2x4 1/1 Running 0 27m
localpv-openebs-ndm-krf47 1/1 Running 0 27m
localpv-openebs-ndm-operator-8d67c79dd-482sb 1/1 Running 0 27m
2.2 Create a StorageClass¶
We create a StorageClass for local PVs under the /data directory.
apiVersion: storage.k8s.io/v1
allowVolumeExpansion: true
kind: StorageClass
metadata:
annotations:
cas.openebs.io/config: |
- name: StorageType
value: "hostpath"
- name: BasePath
value: "/data" ## hostpath path
name: openebs-data
provisioner: openebs.io/local
reclaimPolicy: Retain
volumeBindingMode: WaitForFirstConsumer ## Wait for pod scheduling before creating
Run the following command to install:
Check if it was created successfully:
Output:
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
openebs-data openebs.io/local Retain WaitForFirstConsumer true 24m
2.3 Create a PVC¶
Save the following YAML as test-pvc.yaml:
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: test-pvc
spec:
storageClassName: openebs-data ## StorageClass created above
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
Run the following command to install:
Check the status:
PVC status:
Since the
volumeBindingModeof the StorageClass is set toWaitForFirstConsumer, the PVC status isPending, which is normal.
2.4 Create a Test Deployment¶
Save the following YAML as test-deploy.yaml:
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-pvc
spec:
selector:
matchLabels:
app: nginx-pvc
replicas: 1 # tells deployment to run 2 pods matching the template
template:
metadata:
labels:
app: nginx-pvc
spec:
containers:
- name: nginx-pvc
image: nginx:1.14.1
ports:
- containerPort: 80
resources:
requests:
cpu: 100m
memory: 30Mi
limits:
cpu: 100m
memory: 30Mi
volumeMounts:
- mountPath: "/var/www/html" ## Mount the container directory to the PVC NFS directory
name: storage ## Add storage
volumes:
- name: storage ## Corresponds to the above
persistentVolumeClaim: ## PVC declaration
claimName: test-pvc ## Created PVC label name
Run the following command to install:
Check the status:
Pod status:
PVC status:
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
test-pvc Bound pvc-4023bf79-235e-4310-8fb6-a4f13b3900f2 1Gi RWO openebs-data 2m1s