diff --git a/storageclassdemo/class.yaml b/storageclassdemo/class.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0497ff88169b8bacab5096759be90e0d690c85a7 --- /dev/null +++ b/storageclassdemo/class.yaml @@ -0,0 +1,7 @@ +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: course-nfs-storage + annotations: + storageclass.kubernetes.io/is-default-class: true +provisioner: fuseim.pri/ifs diff --git a/storageclassdemo/deployment.yaml b/storageclassdemo/deployment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..eec02eb44eb9b1ae93b177b4dee3c9b170538341 --- /dev/null +++ b/storageclassdemo/deployment.yaml @@ -0,0 +1,32 @@ +kind: Deployment +apiVersion: extensions/v1beta1 +metadata: + name: nfs-client-provisioner +spec: + replicas: 1 + strategy: + type: Recreate + template: + metadata: + labels: + app: nfs-client-provisioner + spec: + serviceAccountName: nfs-client-provisioner + containers: + - name: nfs-client-provisioner + image: quay.io/external_storage/nfs-client-provisioner:latest + volumeMounts: + - name: nfs-client-root + mountPath: /persistentvolumes + env: + - name: PROVISIONER_NAME + value: fuseim.pri/ifs + - name: NFS_SERVER + value: 10.151.30.57 + - name: NFS_PATH + value: /data/k8s + volumes: + - name: nfs-client-root + nfs: + server: 10.151.30.57 + path: /data/k8s \ No newline at end of file diff --git a/storageclassdemo/rbac.yaml b/storageclassdemo/rbac.yaml new file mode 100644 index 0000000000000000000000000000000000000000..7ef0098fc30b41c4056d4be27c740286f81cd604 --- /dev/null +++ b/storageclassdemo/rbac.yaml @@ -0,0 +1,37 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: nfs-client-provisioner + +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: nfs-client-provisioner-runner +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "create", "delete"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch", "update"] + - apiGroups: ["storage.k8s.io"] + resources: ["storageclasses"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["events"] + verbs: ["list", "watch", "create", "update", "patch"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: run-nfs-client-provisioner +subjects: + - kind: ServiceAccount + name: nfs-client-provisioner + namespace: default +roleRef: + kind: ClusterRole + name: nfs-client-provisioner-runner + apiGroup: rbac.authorization.k8s.io diff --git a/storageclassdemo/test-pod.yaml b/storageclassdemo/test-pod.yaml new file mode 100644 index 0000000000000000000000000000000000000000..56fa3d2ad6ae338c05637a1b28f4dddb584f5b47 --- /dev/null +++ b/storageclassdemo/test-pod.yaml @@ -0,0 +1,22 @@ +kind: Pod +apiVersion: v1 +metadata: + name: test-pod +spec: + containers: + - name: test-pod + image: busybox + imagePullPolicy: IfNotPresent + command: + - "/bin/sh" + args: + - "-c" + - "touch /mnt/SUCCESS && exit 0 || exit 1" + volumeMounts: + - name: nfs-pvc + mountPath: "/mnt" + restartPolicy: "Never" + volumes: + - name: nfs-pvc + persistentVolumeClaim: + claimName: test-pvc diff --git a/storageclassdemo/test-pvc.yaml b/storageclassdemo/test-pvc.yaml new file mode 100644 index 0000000000000000000000000000000000000000..fa5a5d6a94ce4bfe0e9582d0672c043e4f73c7bd --- /dev/null +++ b/storageclassdemo/test-pvc.yaml @@ -0,0 +1,12 @@ +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: test-pvc + annotations: + volume.beta.kubernetes.io/storage-class: "course-nfs-storage" +spec: + accessModes: + - ReadWriteMany + resources: + requests: + storage: 1Mi diff --git a/storageclassdemo/test-statefulset.yaml b/storageclassdemo/test-statefulset.yaml new file mode 100644 index 0000000000000000000000000000000000000000..91679bdf395ec55dde3011d1f863178c9a0877be --- /dev/null +++ b/storageclassdemo/test-statefulset.yaml @@ -0,0 +1,32 @@ +apiVersion: apps/v1beta1 +kind: StatefulSet +metadata: + name: sc-demo +spec: + replicas: 3 + serviceName: "nginx" + template: + metadata: + labels: + app: sc-web + spec: + containers: + - name: nginx + image: nginx:1.7.9 + imagePullPolicy: IfNotPresent + ports: + - containerPort: 80 + volumeMounts: + - name: www + mountPath: /usr/share/nginx/html + volumeClaimTemplates: + - metadata: + name: www + annotations: + volume.beta.kubernetes.io/storage-class: "course-nfs-storage" + spec: + accessModes: + - ReadWriteMany + resources: + requests: + storage: 1Mi \ No newline at end of file