cephfs/deploy/k8s: updated naming and some permissions

This commit is contained in:
gman 2018-03-18 15:08:39 +01:00
parent 99bdbf2182
commit 257a11780f
6 changed files with 50 additions and 40 deletions

View File

@ -1,12 +1,12 @@
apiVersion: storage.k8s.io/v1 apiVersion: storage.k8s.io/v1
kind: StorageClass kind: StorageClass
metadata: metadata:
name: cephfs name: csi-cephfs
provisioner: cephfsplugin provisioner: csi-cephfsplugin
parameters: parameters:
adminID: admin monitors: 192.168.122.11:6789
adminSecret: AQCdsp9aaowqEhAAHx5EFnTQBnTU7Dr1UzHwmQ== rootPath: /
clusterName: ceph user: admin
pool: cephfs csiProvisionerSecretName: csi-cephfs-secret
monitor: 192.168.122.11:6789 csiProvisionerSecretNameSpace: default
reclaimPolicy: Delete reclaimPolicy: Delete

View File

@ -3,30 +3,39 @@
apiVersion: v1 apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
name: csi-nodeplugin name: csi-cephfsplugin
--- ---
kind: ClusterRole kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
metadata: metadata:
name: csi-nodeplugin name: csi-cephfsplugin
rules: rules:
- apiGroups: [""] - apiGroups: [""]
resources: ["nodes"] resources: ["nodes"]
verbs: ["get", "list", "update"] verbs: ["get", "list", "update"]
- apiGroups: [""]
resources: ["namespaces"]
verbs: ["get", "list"]
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "list", "watch", "update"]
- apiGroups: ["storage.k8s.io"]
resources: ["volumeattachments"]
verbs: ["get", "list", "watch", "update"]
--- ---
kind: ClusterRoleBinding kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
metadata: metadata:
name: csi-nodeplugin name: csi-cephfsplugin
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: csi-nodeplugin name: csi-cephfsplugin
namespace: default namespace: default
roleRef: roleRef:
kind: ClusterRole kind: ClusterRole
name: csi-nodeplugin name: csi-cephfsplugin
apiGroup: rbac.authorization.k8s.io apiGroup: rbac.authorization.k8s.io
--- ---
# This YAML file contains driver-registrar & csi driver nodeplugin API objects, # This YAML file contains driver-registrar & csi driver nodeplugin API objects,
@ -35,17 +44,17 @@ roleRef:
kind: DaemonSet kind: DaemonSet
apiVersion: apps/v1beta2 apiVersion: apps/v1beta2
metadata: metadata:
name: csi-nodeplugin-cephfsplugin name: csi-cephfsplugin
spec: spec:
selector: selector:
matchLabels: matchLabels:
app: csi-nodeplugin-cephfsplugin app: csi-cephfsplugin
template: template:
metadata: metadata:
labels: labels:
app: csi-nodeplugin-cephfsplugin app: csi-cephfsplugin
spec: spec:
serviceAccount: csi-nodeplugin serviceAccount: csi-cephfsplugin
hostNetwork: true hostNetwork: true
containers: containers:
- name: driver-registrar - name: driver-registrar
@ -55,15 +64,15 @@ spec:
- "--csi-address=$(ADDRESS)" - "--csi-address=$(ADDRESS)"
env: env:
- name: ADDRESS - name: ADDRESS
value: /var/lib/kubelet/plugins/cephfsplugin/csi.sock value: /var/lib/kubelet/plugins/csi-cephfsplugin/csi.sock
- name: KUBE_NODE_NAME - name: KUBE_NODE_NAME
valueFrom: valueFrom:
fieldRef: fieldRef:
fieldPath: spec.nodeName fieldPath: spec.nodeName
volumeMounts: volumeMounts:
- name: socket-dir - name: socket-dir
mountPath: /var/lib/kubelet/plugins/cephfsplugin mountPath: /var/lib/kubelet/plugins/csi-cephfsplugin
- name: cephfsplugin - name: csi-cephfsplugin
securityContext: securityContext:
privileged: true privileged: true
capabilities: capabilities:
@ -74,18 +83,18 @@ spec:
- "--nodeid=$(NODE_ID)" - "--nodeid=$(NODE_ID)"
- "--endpoint=$(CSI_ENDPOINT)" - "--endpoint=$(CSI_ENDPOINT)"
- "--v=5" - "--v=5"
- "--drivername=cephfsplugin" - "--drivername=csi-cephfsplugin"
env: env:
- name: NODE_ID - name: NODE_ID
valueFrom: valueFrom:
fieldRef: fieldRef:
fieldPath: spec.nodeName fieldPath: spec.nodeName
- name: CSI_ENDPOINT - name: CSI_ENDPOINT
value: unix://var/lib/kubelet/plugins/cephfsplugin/csi.sock value: unix://var/lib/kubelet/plugins/csi-cephfsplugin/csi.sock
imagePullPolicy: "IfNotPresent" imagePullPolicy: "IfNotPresent"
volumeMounts: volumeMounts:
- name: plugin-dir - name: plugin-dir
mountPath: /var/lib/kubelet/plugins/cephfsplugin mountPath: /var/lib/kubelet/plugins/csi-cephfsplugin
- name: pods-mount-dir - name: pods-mount-dir
mountPath: /var/lib/kubelet/pods mountPath: /var/lib/kubelet/pods
mountPropagation: "Bidirectional" mountPropagation: "Bidirectional"
@ -94,12 +103,10 @@ spec:
- mountPath: /lib/modules - mountPath: /lib/modules
name: lib-modules name: lib-modules
readOnly: true readOnly: true
#- name: cephfs-config
# mountPath: /etc/ceph
volumes: volumes:
- name: plugin-dir - name: plugin-dir
hostPath: hostPath:
path: /var/lib/kubelet/plugins/cephfsplugin path: /var/lib/kubelet/plugins/csi-cephfsplugin
type: DirectoryOrCreate type: DirectoryOrCreate
- name: pods-mount-dir - name: pods-mount-dir
hostPath: hostPath:
@ -107,7 +114,7 @@ spec:
type: Directory type: Directory
- name: socket-dir - name: socket-dir
hostPath: hostPath:
path: /var/lib/kubelet/plugins/cephfsplugin path: /var/lib/kubelet/plugins/csi-cephfsplugin
type: DirectoryOrCreate type: DirectoryOrCreate
- name: host-sys - name: host-sys
hostPath: hostPath:
@ -115,6 +122,3 @@ spec:
- name: lib-modules - name: lib-modules
hostPath: hostPath:
path: /lib/modules path: /lib/modules
#- name: cephfs-config
# hostPath:
# path: /etc/ceph

View File

@ -12,6 +12,9 @@ apiVersion: rbac.authorization.k8s.io/v1
metadata: metadata:
name: external-attacher-runner name: external-attacher-runner
rules: rules:
- apiGroups: [""]
resources: ["events"]
verbs: ["get", "list", "watch", "update"]
- apiGroups: [""] - apiGroups: [""]
resources: ["persistentvolumes"] resources: ["persistentvolumes"]
verbs: ["get", "list", "watch", "update"] verbs: ["get", "list", "watch", "update"]
@ -72,13 +75,13 @@ spec:
- "--csi-address=$(ADDRESS)" - "--csi-address=$(ADDRESS)"
env: env:
- name: ADDRESS - name: ADDRESS
value: /var/lib/kubelet/plugins/cephfsplugin/csi.sock value: /var/lib/kubelet/plugins/csi-cephfsplugin/csi.sock
imagePullPolicy: "IfNotPresent" imagePullPolicy: "IfNotPresent"
volumeMounts: volumeMounts:
- name: socket-dir - name: socket-dir
mountPath: /var/lib/kubelet/plugins/cephfsplugin mountPath: /var/lib/kubelet/plugins/csi-cephfsplugin
volumes: volumes:
- name: socket-dir - name: socket-dir
hostPath: hostPath:
path: /var/lib/kubelet/plugins/cephfsplugin path: /var/lib/kubelet/plugins/csi-cephfsplugin
type: DirectoryOrCreate type: DirectoryOrCreate

View File

@ -18,6 +18,9 @@ apiVersion: rbac.authorization.k8s.io/v1
metadata: metadata:
name: external-provisioner-runner name: external-provisioner-runner
rules: rules:
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get", "list"]
- apiGroups: [""] - apiGroups: [""]
resources: ["persistentvolumes"] resources: ["persistentvolumes"]
verbs: ["get", "list", "watch", "create", "delete"] verbs: ["get", "list", "watch", "create", "delete"]
@ -77,18 +80,18 @@ spec:
- name: csi-provisioner - name: csi-provisioner
image: quay.io/k8scsi/csi-provisioner:v0.2.0 image: quay.io/k8scsi/csi-provisioner:v0.2.0
args: args:
- "--provisioner=cephfsplugin" - "--provisioner=csi-cephfsplugin"
- "--csi-address=$(ADDRESS)" - "--csi-address=$(ADDRESS)"
- "--v=5" - "--v=5"
env: env:
- name: ADDRESS - name: ADDRESS
value: /var/lib/kubelet/plugins/cephfsplugin/csi.sock value: /var/lib/kubelet/plugins/csi-cephfsplugin/csi.sock
imagePullPolicy: "IfNotPresent" imagePullPolicy: "IfNotPresent"
volumeMounts: volumeMounts:
- name: socket-dir - name: socket-dir
mountPath: /var/lib/kubelet/plugins/cephfsplugin mountPath: /var/lib/kubelet/plugins/csi-cephfsplugin
volumes: volumes:
- name: socket-dir - name: socket-dir
hostPath: hostPath:
path: /var/lib/kubelet/plugins/cephfsplugin path: /var/lib/kubelet/plugins/csi-cephfsplugin
type: DirectoryOrCreate type: DirectoryOrCreate

View File

@ -12,6 +12,6 @@ spec:
volumes: volumes:
- name: mypvc - name: mypvc
persistentVolumeClaim: persistentVolumeClaim:
claimName: cephfs-pvc claimName: csi-cephfs-pvc
readOnly: false readOnly: false

View File

@ -1,11 +1,11 @@
apiVersion: v1 apiVersion: v1
kind: PersistentVolumeClaim kind: PersistentVolumeClaim
metadata: metadata:
name: cephfs-pvc name: csi-cephfs-pvc
spec: spec:
accessModes: accessModes:
- ReadWriteMany - ReadWriteMany
resources: resources:
requests: requests:
storage: 5Gi storage: 5Gi
storageClassName: cephfs storageClassName: csi-cephfs