This section helps you to install OpenEBS on OpenShift. If you are new to OpenShift, you can follow the links listed below.
Once the OpenShift cluster is ready, you can proceed with installing OpenEBS packages. The procedure is slightly different when compared to other platforms. OpenShift uses commands that are not regular Kubernetes commands.
To install OpenEBS in an OpenShift environment, you need to set role/permission and make a few changes to the commands mentioned in the Installation section. The following procedure allows you to setup OpenEBS.
- Run the following command to create a new administrator user with cluster-admin role/permissions which can be used to run the OpenEBS operator and deploy applications.
oc adm policy add-cluster-role-to-user cluster-admin admin --as=system:admin
- (Optional) If the password is not set, assign the password to the administrator user using the following command.
- (Optional) If the admin login has timed out, login as administrator user and use the "default" project (administrator is logged into this project by default).
oc login -u admin
- Provide access to the host-volumes (which are required by the OpenEBS volume replicas) by updating the default security context (scc) using the following command.
oc edit scc restricted
- Add allowHostDirVolumePlugin: true and save changes.
Alternatively, you can use the following command.
oc adm policy add-scc-to-user hostaccess admin --as:system:admin
- Allow the containers in the project to run as root using the following command.
oc adm policy add-scc-to-user anyuid -z default --as=system:admin
Note: While the above procedure may be sufficient to enable host access to the containers, you may also need to do the following.
- Disable selinux (via
setenforce 0) to ensure the same (disable on all OpenShift nodes).
- Edit the restricted scc to use
runAsUser: type: RunAsAny(the replica pod runs with root user).
Download the latest OpenEBS operator files and sample application specifications on the OpenShift-Master machine using the following commands.
git clone https://github.com/openebs/openebs.git cd openebs/k8s
Apply the openebs-operator on the OpenShift cluster using the following commands.
oc apply -f openebs-operator.yaml oc apply -f openebs-storageclasses.yaml
Verify that the OpenEBS operator services are created successfully and deployments are running using the following commands. Also, check whether the storage classes are created successfully.
oc get deployments oc get sa oc get clusterrole openebs-maya-operator oc get sc
Deploy a sample application with OpenEBS storage.
Use OpenEBS as persistent storage for a Percona deployment by selecting the openebs-percona storageclass in the persistent volume claim. A sample is available in the openebs git repository (which was cloned in the previous steps).
Apply the following Percona deployment yaml using the following commands.
cd demo/percona oc apply -f demo-percona-mysql-pvc.yaml
Verify that the deployment runs successfully using the following commands.
oc get pods