A Unity LUN that is provisioned to the worker nodes cannot be used directly as a storage option for the image registry. You must create a PV and PVC mappings to the Unity LUN.
Ensure that the prerequisites have been met (see Prerequisites for using Unity storage) and then perform the tasks in the following procedures:
In the following sample, the IP address for targetPortal and the IQN for iqn is from the Unity Unisphere UI, as shown in the following figure.
Note: In the Unisphere UI, under STORAGE, select Block, and then click the iSCSI Interfaces tab.
Figure 20. iSCSI IP address and IQN info in Unisphere
To create a PV:
[core@csah ~]$ cat podpv.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: podpv
spec:
capacity:
storage: 20G
accessModes:
- ReadWriteOnce
iscsi:
targetPortal: 100.82.47.29:3260
iqn: iqn.1992-04.com.emc:cx.apm00193820970.a7
lun: 1
fsType: ext4
readOnly: false
[core@csah ~]$ oc create -f podpv.yaml
persistentvolume/podpv created
A PVC is used in the image registry operator as a storage option for the image registry. Create a PVC and then the pod as follows:
[core@csah ~]$ cat podpvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: podpvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20G
[core@csah ~]$ oc create -f podpv.yaml
persistentvolume/podpv created
[core@csah ~]$ cat podunity.yaml
apiVersion: v1
kind: Pod
metadata:
name: unitypod
spec:
containers:
- name: nginx
image: nginx
volumeMounts:
- mountPath: "/var/www/html"
name: unitypvc
volumes:
- name: unitypvc
persistentVolumeClaim:
claimName: podpvc
[core@csah ~]$ oc create -f podunity.yaml
pod/unitypod created
If the pod creation fails, run oc describe pod unitypod to check for errors. Under Events, a FailedMount error is displayed if the block storage is not visible in the worker node where the pod will be started. To address this issue, run sudo rescan-scsi-bus.sh in all worker nodes as user core.
Ensure that the LUN number that is displayed matches the LUN number on the worker node (ls /dev/disk/by-path).
[core@csah ~]$ oc get pods
NAME READY STATUS RESTARTS AGE
unitypod 1/1 Running 0 31m
[core@csah ~]$ oc exec -it unitypod -- df -h /var/www/html
Filesystem Size Used Avail Use% Mounted on
/dev/sdc 20G 45M 20G 1% /var/www/html