To create a pod using an iSCSI PVC:
apiVersion: v1
kind: Pod
metadata:
name: <pod name>
spec:
containers:
- name: <container name>
image: <image name>
volumeMounts:
- mountPath: "<mount point>"
name: <volume name>
volumes:
- name: <volume name>
persistentVolumeClaim:
claimName: <iscsi persistent volume claim>
We used the iscsipod.yaml YAML file:
apiVersion: v1
kind: Pod
metadata:
name: iscsipod
spec:
containers:
- name: iscsi
image: nginx
volumeMounts:
- mountPath: "/var/www/html"
name: iscsivol
volumes:
- name: iscsivol
persistentVolumeClaim:
claimName: iscsipvc
oc apply -f iscsipod.yaml
oc get pod iscsipod
NAME READY STATUS RESTARTS AGE
iscsipod 1/1 Running 0 7m21s
oc exec -it iscsipod -- df -h /var/www/html
Filesystem Size Used Avail Use% Mounted on
/dev/sdb 25G 45M 25G 1% /var/www/html