Skip to content

Instantly share code, notes, and snippets.

@JohnStrunk
Created June 6, 2019 13:02
Show Gist options
  • Save JohnStrunk/da67a54db3600d85d3afb0995cccfa85 to your computer and use it in GitHub Desktop.
Save JohnStrunk/da67a54db3600d85d3afb0995cccfa85 to your computer and use it in GitHub Desktop.
local block
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: block-pv
spec:
accessModes:
- ReadWriteOnce
volumeMode: Block
storageClassName: local-block
resources:
requests:
storage: 10Gi
---
kind: Pod
apiVersion: v1
metadata:
name: centos
spec:
containers:
- name: centos
image: centos:7
command: ["/bin/bash", "-c"]
args: ["sleep infinity"]
securityContext:
privileged: true
capabilities:
add:
- ALL
volumeDevices:
- name: block
devicePath: /dev/myblock
volumes:
- name: block
persistentVolumeClaim:
claimName: block-pv
$ ./k get no -owide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
master Ready master 22h v1.14.2 192.168.121.138 <none> CentOS Linux 7 (Core) 3.10.0-957.12.2.el7.x86_64 docker://1.13.1
worker0 Ready worker 22h v1.14.2 192.168.121.243 <none> CentOS Linux 7 (Core) 3.10.0-957.12.2.el7.x86_64 docker://1.13.1
worker1 Ready worker 22h v1.14.2 192.168.121.147 <none> CentOS Linux 7 (Core) 3.10.0-957.12.2.el7.x86_64 docker://1.13.1
worker2 Ready worker 22h v1.14.2 192.168.121.36 <none> CentOS Linux 7 (Core) 3.10.0-957.12.2.el7.x86_64 docker://1.13.1
$ ./k version
Client Version: version.Info{Major:"1", Minor:"12", GitVersion:"v1.12.5", GitCommit:"51dd616cdd25d6ee22c83a858773b607328a18ec", GitTreeState:"archive", BuildDate:"2019-03-05T13:36:50Z", GoVersion:"go1.12", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.2", GitCommit:"66049e3b21efe110454d67df4fa62b08ea79a19b", GitTreeState:"clean", BuildDate:"2019-05-16T16:14:56Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
apiVersion: v1
kind: PersistentVolume
metadata:
annotations:
pv.kubernetes.io/bound-by-controller: "yes"
pv.kubernetes.io/provisioned-by: local-volume-provisioner-worker0-66dce061-879f-11e9-92e6-525400666bac
creationTimestamp: 2019-06-05T15:23:54Z
finalizers:
- kubernetes.io/pv-protection
name: local-pv-9a768566
resourceVersion: "28288"
selfLink: /api/v1/persistentvolumes/local-pv-9a768566
uid: ee094701-87a5-11e9-a0fc-525400666bac
spec:
accessModes:
- ReadWriteOnce
capacity:
storage: 30Gi
claimRef:
apiVersion: v1
kind: PersistentVolumeClaim
name: block-pv
namespace: default
resourceVersion: "28283"
uid: e116441c-885a-11e9-b764-525400666bac
local:
path: /dev/kube_blk_devs/vdb
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- worker0
persistentVolumeReclaimPolicy: Delete
storageClassName: local-block
volumeMode: Block
status:
phase: Bound
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment