Skip to content

Instantly share code, notes, and snippets.

@kmova
Created July 4, 2019 05:16
Show Gist options
  • Save kmova/1c15a0ca5e63a24d7ae1718496175b23 to your computer and use it in GitHub Desktop.
Save kmova/1c15a0ca5e63a24d7ae1718496175b23 to your computer and use it in GitHub Desktop.
Test OpenEBS Local PV by using GKE Local SSD as raw block devices.
(a) Create v1.12.8-gke.10 cluster with one node, two local SSDs.
(b) Prior to installing openebs, I logged into the node and did the following to wipeout the ext4 that get pre-formatted.
> sudo umount /mnt/disks/ssd0
> sudo umount /mnt/disks/ssd1
> sudo wipefs -af /dev/sdb
> sudo wipefs -af /dev/sdc
> lsblk -o NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT
NAME TYPE SIZE FSTYPE MOUNTPOINT
sda disk 100G
├─sda1 part 99.9G ext4 /
├─sda14 part 4M
└─sda15 part 106M vfat /boot/efi
sdb disk 375G
sdc disk 375G
(c) Install openebs using `kubectl apply -f https://openebs.github.io/charts/openebs-operator.yaml`
(d) Run a sample busybox pod with localpv with device type. `kubectl apply -f busybox-localpv-device.yaml`
(e) Wait for the pod to come to running state.
```
kubectl get pv -o yaml pvc-34652370-9e19-11e9-9960-42010a800055
apiVersion: v1
kind: PersistentVolume
metadata:
annotations:
local.openebs.io/blockdeviceclaim: bdc-pvc-34652370-9e19-11e9-9960-42010a800055
pv.kubernetes.io/provisioned-by: openebs.io/local
creationTimestamp: 2019-07-04T05:04:35Z
finalizers:
- kubernetes.io/pv-protection
labels:
openebs.io/cas-type: local-device
name: pvc-34652370-9e19-11e9-9960-42010a800055
resourceVersion: "4269"
selfLink: /api/v1/persistentvolumes/pvc-34652370-9e19-11e9-9960-42010a800055
uid: 376a9b15-9e19-11e9-9960-42010a800055
spec:
accessModes:
- ReadWriteOnce
capacity:
storage: 5G
claimRef:
apiVersion: v1
kind: PersistentVolumeClaim
name: demo-vol1-claim
namespace: default
resourceVersion: "4240"
uid: 34652370-9e19-11e9-9960-42010a800055
local:
fsType: ""
path: /dev/disk/by-id/scsi-0Google_EphemeralDisk_local-ssd-1
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- gke-kmova-helm-default-pool-f5bbba44-3vg7
persistentVolumeReclaimPolicy: Delete
storageClassName: openebs-device
status:
phase: Bound
```
(f) Login to node and check mount points
```
kiran_mova@gke-kmova-helm-default-pool-f5bbba44-3vg7:~$ sudo mount | grep local
/dev/sdc on /var/lib/kubelet/plugins/kubernetes.io/local-volume/mounts/pvc-8b9057d9-9e18-11e9-9960-42010a800055 type ext4 (rw,relatime,data=ordered)
/dev/sdc on /var/lib/kubelet/plugins/kubernetes.io/local-volume/mounts/pvc-8b9057d9-9e18-11e9-9960-42010a800055 type ext4 (rw,relatime,data=ordered)
/dev/sdc on /home/kubernetes/containerized_mounter/rootfs/var/lib/kubelet/plugins/kubernetes.io/local-volume/mounts/pvc-8b9057d9-9e18-11e9-9960-42010a800055 type ext4 (rw,relatime,data=ordered)
/dev/sdc on /home/kubernetes/containerized_mounter/rootfs/var/lib/kubelet/plugins/kubernetes.io/local-volume/mounts/pvc-8b9057d9-9e18-11e9-9960-42010a800055 type ext4 (rw,relatime,data=ordered)
/dev/sdc on /var/lib/kubelet/pods/8b8b97a1-9e18-11e9-9960-42010a800055/volumes/kubernetes.io~local-volume/pvc-8b9057d9-9e18-11e9-9960-42010a800055 type ext4 (rw,relatime,data=ordered)
/dev/sdc on /var/lib/kubelet/pods/8b8b97a1-9e18-11e9-9960-42010a800055/volumes/kubernetes.io~local-volume/pvc-8b9057d9-9e18-11e9-9960-42010a800055 type ext4 (rw,relatime,data=ordered)
/dev/sdc on /home/kubernetes/containerized_mounter/rootfs/var/lib/kubelet/pods/8b8b97a1-9e18-11e9-9960-42010a800055/volumes/kubernetes.io~local-volume/pvc-8b9057d9-9e18-11e9-9960-42010a800055 type ext4 (rw,relatime,data=ordered)
/dev/sdc on /home/kubernetes/containerized_mounter/rootfs/var/lib/kubelet/pods/8b8b97a1-9e18-11e9-9960-42010a800055/volumes/kubernetes.io~local-volume/pvc-8b9057d9-9e18-11e9-9960-42010a800055 type ext4 (rw,relatime,data=ordered)
```
(g) Delete the pod and pvc. `kubectl delete -f busybox-localpv-device.yaml`
(h) Login to node and check the mount points - the above command returned empty. All mounts were cleared.
(i) Recreate the sample busybox pod with localpv with device type. `kubectl apply -f busybox-localpv-device.yaml`
(j) Wait for the pod to come to running state. Login to node to check for mounts.
```
sudo mount | grep local
/dev/sdc on /var/lib/kubelet/plugins/kubernetes.io/local-volume/mounts/pvc-34652370-9e19-11e9-9960-42010a800055 type ext4 (rw,relatime,data=ordered)
/dev/sdc on /var/lib/kubelet/plugins/kubernetes.io/local-volume/mounts/pvc-34652370-9e19-11e9-9960-42010a800055 type ext4 (rw,relatime,data=ordered)
/dev/sdc on /home/kubernetes/containerized_mounter/rootfs/var/lib/kubelet/plugins/kubernetes.io/local-volume/mounts/pvc-34652370-9e19-11e9-9960-42010a800055 type ext4 (rw,relatime,data=ordered)
/dev/sdc on /home/kubernetes/containerized_mounter/rootfs/var/lib/kubelet/plugins/kubernetes.io/local-volume/mounts/pvc-34652370-9e19-11e9-9960-42010a800055 type ext4 (rw,relatime,data=ordered)
/dev/sdc on /var/lib/kubelet/pods/3460e826-9e19-11e9-9960-42010a800055/volumes/kubernetes.io~local-volume/pvc-34652370-9e19-11e9-9960-42010a800055 type ext4 (rw,relatime,data=ordered)
/dev/sdc on /var/lib/kubelet/pods/3460e826-9e19-11e9-9960-42010a800055/volumes/kubernetes.io~local-volume/pvc-34652370-9e19-11e9-9960-42010a800055 type ext4 (rw,relatime,data=ordered)
/dev/sdc on /home/kubernetes/containerized_mounter/rootfs/var/lib/kubelet/pods/3460e826-9e19-11e9-9960-42010a800055/volumes/kubernetes.io~local-volume/pvc-34652370-9e19-11e9-9960-42010a800055 type ext4 (rw,relatime,data=ordered)
/dev/sdc on /home/kubernetes/containerized_mounter/rootfs/var/lib/kubelet/pods/3460e826-9e19-11e9-9960-42010a800055/volumes/kubernetes.io~local-volume/pvc-34652370-9e19-11e9-9960-42010a800055 type ext4 (rw,relatime,data=ordered)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment