Skip to content

Instantly share code, notes, and snippets.

@sbezverk
Created March 1, 2018 01:52
Show Gist options
  • Save sbezverk/2229db8d27968c1a968e3a4ab5dabe14 to your computer and use it in GitHub Desktop.
Save sbezverk/2229db8d27968c1a968e3a4ab5dabe14 to your computer and use it in GitHub Desktop.
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: csi-hostpath-sc
provisioner: csi-hostpath
parameters:
csiProvisionerSecretName: csi-secret
csiProvisionerSecretNamespace: default
reclaimPolicy: Delete
volumeBindingMode: Immediate
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: csi-service-account
namespace: default
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: csi-cluster-role
rules:
- apiGroups:
- ""
resources:
- persistentvolumes
verbs:
- create
- delete
- get
- list
- watch
- update
- apiGroups:
- ""
resources:
- secrets
verbs:
- get
- list
- apiGroups:
- ""
resources:
- persistentvolumeclaims
verbs:
- get
- list
- watch
- update
- apiGroups:
- ""
resources:
- nodes
verbs:
- get
- list
- watch
- update
- apiGroups:
- storage.k8s.io
resources:
- volumeattachments
verbs:
- get
- list
- watch
- update
- apiGroups:
- storage.k8s.io
resources:
- storageclasses
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- events
verbs:
- list
- watch
- create
- update
- patch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: csi-role-binding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: csi-cluster-role
subjects:
- kind: ServiceAccount
name: csi-service-account
namespace: default
---
apiVersion: v1
kind: Pod
metadata:
labels:
app: hostpath-driver
name: csi-pod
namespace: default
spec:
serviceAccount: csi-service-account
containers:
- args:
- --v=5
- --provisioner=csi-hostpath
- --csi-address=/csi/csi.sock
image: 192.168.80.240:4000/k8scsi/csi-provisioner:v0.2.0
imagePullPolicy: Always
name: external-provisioner
volumeMounts:
- mountPath: /csi
name: socket-dir
- args:
- --v=5
- --csi-address=/csi/csi.sock
env:
- name: KUBE_NODE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
image: 192.168.80.240:4000/k8scsi/driver-registrar:v0.2.0
imagePullPolicy: Always
name: driver-registrar
volumeMounts:
- mountPath: /csi
name: socket-dir
- args:
- --v=5
- --csi-address=$(ADDRESS)
env:
- name: ADDRESS
value: /csi/csi.sock
image: 192.168.80.240:4000/k8scsi/csi-attacher:v0.2.0
imagePullPolicy: Always
name: external-attacher
volumeMounts:
- mountPath: /csi
name: socket-dir
- args:
- --v=5
- --endpoint=$(CSI_ENDPOINT)
- --nodeid=$(KUBE_NODE_NAME)
env:
- name: CSI_ENDPOINT
value: unix:///csi/csi.sock
- name: KUBE_NODE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
image: 192.168.80.240:4000/k8scsi/hostpathplugin:v0.2.0
imagePullPolicy: Always
name: hostpath-driver
securityContext:
privileged: true
volumeMounts:
- mountPath: /csi
name: socket-dir
- mountPath: /var/lib/kubelet/pods
mountPropagation: Bidirectional
name: mountpoint-dir
volumes:
- hostPath:
path: /var/lib/kubelet/plugins/csi-hostpath
type: DirectoryOrCreate
name: socket-dir
- hostPath:
path: /var/lib/kubelet/pods
type: DirectoryOrCreate
name: mountpoint-dir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment