Make sure the prerequisites for StorageOS are satisfied before proceeding.
StorageOS can interface with Kubernetes using the native volume driver or the new CSI interface. For Rancher deployments, we recommend the StorageOS Operator install using native drivers, unless you have a specific requirement.
CSI cannot be used if Kubernetes is deployed in nodes using RancherOS. It can be used if running in distributions such as CentOS, RHEL, Debian or Supported Ubuntu kernels.
Install StorageOS operator
Our cluster operator is a Kubernetes native application developed to deploy and configure StorageOS clusters, and assist with maintenance operations. We recommend its use for standard installations.
The operator is a Kubernetes controller that watches the
CRD. Once the controller is ready, a StorageOS cluster definition can be
created. The operator will deploy a StorageOS cluster based on the
configuration specified in the cluster definition.
The StorageOS Cluster Operator can be installed with two options.
- Using Helm
- Standard yaml manifests
(Option 1) Using Helm
helm repo add storageos https://charts.storageos.com helm install storageos/storageoscluster-operator --namespace storageos-operator
The Helm chart can be found in the Charts public repository.
The StorageOS Cluster Operator source code can be found in the cluster-operator repository.
The helm server, tiller, needs privileges to be able to deploy the StorageOS Cluster Operator. You can add the service account to the cluster-admin role for simplicity or create a role that matches the cluster-operator requirements.
(Option 2) Standard yaml manifests
git clone https://github.com/storageos/deploy.git storageos cd storageos/k8s/deploy-storageos/cluster-operator ./deploy-operator.sh
Verify the Cluster Operator Pod
[[email protected]]# kubectl -n storageos-operator get pod NAME READY STATUS RESTARTS AGE storageoscluster-operator-68678798ff-f28zw 1/1 Running 0 3m
The READY 1/1 indicates that
stosresources can be created.
Create a Secret
Before deploying a StorageOS cluster, create a Secret to define the StorageOS API Username and Password in base64 encoding.
kubectl create -f - <<END apiVersion: v1 kind: Secret metadata: name: "storageos-api" namespace: "default" labels: app: "storageos" type: "kubernetes.io/storageos" data: # echo -n '<secret>' | base64 apiUsername: c3RvcmFnZW9z apiPassword: c3RvcmFnZW9z END
This example contains a default password, for production installations, use a unique, strong password.
Make sure that the encoding of the credentials doesn’t have special characters such as ‘\n’.
You can define a base64 value by
echo -n "mystring" | base64.
Trigger a StorageOS installation
This is a Cluster Definition example.
apiVersion: "storageos.com/v1alpha1" kind: "StorageOSCluster" metadata: name: "example-storageos" spec: secretRefName: "storageos-api" # Reference the Secret created in the previous step secretRefNamespace: "default" # Namespace of the Secret images: nodeContainer: "storageos/node:1.1.0" # StorageOS version resources: requests: memory: "512Mi" sharedDir: '/var/lib/kubelet/volumeplugins/kubernetes.io~storageos' nodeSelectorTerms: - matchExpressions: - key: "node-role.kubernetes.io/worker" operator: In values: - "true" END
specparameters available on the Cluster Operator configuration page.
You can find more examples such as deployments with CSI or deployments referencing a external etcd kv store. store for StorageOS in the Cluster Operator examples page.
If this is your first installation you may wish to follow the StorageOS Volume guide for an example of how to mount a StorageOS volume in a Pod.
CSI allows you to set StorageOS features (
on the StorageClass, but not on the PVC definition. If you need to set labels
on PVCs or your environment does not support CSI, you may install StorageOS