text
stringlengths
0
59.1k
### Pre-provisioned Volumes
#### Pod
Pods can be created that access volumes directly.
1. Create a volume using the StorageOS UI, CLI or API. Consult the [StorageOS documentation](https://docs.storageos.com) for details.
1. Create a pod that refers to the new volume. In this case the volume is named `redis-vol01`.
Example spec:
```yaml
apiVersion: v1
kind: Pod
metadata:
labels:
name: redis
role: master
name: test-storageos-redis
spec:
containers:
- name: master
image: kubernetes/redis:v1
env:
- name: MASTER
value: "true"
ports:
- containerPort: 6379
resources:
limits:
cpu: "0.1"
volumeMounts:
- mountPath: /redis-master-data
name: redis-data
volumes:
- name: redis-data
storageos:
# This volume must already exist within StorageOS
volumeName: redis-vol01
# volumeNamespace is optional, and specifies the volume scope within
# StorageOS. If no namespace is provided, it will use the namespace
# of the pod. Set to `default` or leave blank if you are not using
# namespaces.
#volumeNamespace: test-storageos
# The filesystem type to format the volume with, if required.
fsType: ext4
# The secret name for API credentials
secretName: storageos-secret
```
[Download example](storageos-pod.yaml?raw=true)
Create the pod:
```bash
$ kubectl create -f examples/volumes/storageos/storageos-pod.yaml
```
Verify that the pod is running:
```bash
$ kubectl get pods test-storageos-redis
NAME READY STATUS RESTARTS AGE
test-storageos-redis 1/1 Running 0 30m
```
### Persistent Volumes
1. Create a volume using the StorageOS UI, CLI or API. Consult the [StorageOS documentation](https://docs.storageos.com) for details.
1. Create the persistent volume `redis-vol01`.
Example spec:
```yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv0001
spec:
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Delete
storageos:
# This volume must already exist within StorageOS
volumeName: pv0001
# volumeNamespace is optional, and specifies the volume scope within
# StorageOS. Set to `default` or leave blank if you are not using
# namespaces.
#volumeNamespace: default
# The filesystem type to create on the volume, if required.
fsType: ext4
# The secret name for API credentials
secretName: storageos-secret
```
[Download example](storageos-pv.yaml?raw=true)