-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from fcabrera23/nfs-storage
External storage - NFS Deployment files
- Loading branch information
Showing
5 changed files
with
142 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: storage.k8s.io/v1 | ||
kind: StorageClass | ||
metadata: | ||
name: nfs-client | ||
provisioner: k8s-sigs.io/nfs-subdir-external-provisioner # or choose another name, must match deployment's env PROVISIONER_NAME' | ||
parameters: | ||
pathPattern: "" # waits for nfs.io/storage-path annotation, if not specified will accept as empty string. | ||
onDelete: delete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
kind: Deployment | ||
apiVersion: apps/v1 | ||
metadata: | ||
name: nfs-client-provisioner | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: nfs-client-provisioner | ||
strategy: | ||
type: Recreate | ||
template: | ||
metadata: | ||
labels: | ||
app: nfs-client-provisioner | ||
spec: | ||
serviceAccountName: nfs-client-provisioner | ||
containers: | ||
- name: nfs-client-provisioner | ||
image: k8s.gcr.io/sig-storage/nfs-subdir-external-provisioner:v4.0.2 | ||
volumeMounts: | ||
- name: nfs-client-root | ||
mountPath: /var/persistentvolumes | ||
env: | ||
- name: PROVISIONER_NAME | ||
value: k8s-sigs.io/nfs-subdir-external-provisioner | ||
- name: NFS_SERVER | ||
value: <YOUR_NFS_SERVER_IP> | ||
- name: NFS_PATH | ||
value: <YOUR_NFS_SERVER_SHARE> | ||
volumes: | ||
- name: nfs-client-root | ||
nfs: | ||
server: <YOUR_NFS_SERVER_IP> | ||
path: <YOUR_NFS_SERVER_SHARE> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: volume-test | ||
namespace: default | ||
spec: | ||
containers: | ||
- name: volume-test | ||
image: nginx:stable-alpine | ||
imagePullPolicy: IfNotPresent | ||
volumeMounts: | ||
- name: volv | ||
mountPath: /data | ||
ports: | ||
- containerPort: 80 | ||
volumes: | ||
- name: volv | ||
persistentVolumeClaim: | ||
claimName: nfs-pvc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: nfs-pvc | ||
namespace: default | ||
spec: | ||
accessModes: | ||
- ReadWriteMany | ||
storageClassName: nfs-client | ||
resources: | ||
requests: | ||
storage: 1Mi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: nfs-client-provisioner | ||
# replace with namespace where provisioner is deployed | ||
namespace: default | ||
--- | ||
kind: ClusterRole | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: nfs-client-provisioner-runner | ||
rules: | ||
- apiGroups: [""] | ||
resources: ["nodes"] | ||
verbs: ["get", "list", "watch"] | ||
- 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: ["create", "update", "patch"] | ||
--- | ||
kind: ClusterRoleBinding | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: run-nfs-client-provisioner | ||
subjects: | ||
- kind: ServiceAccount | ||
name: nfs-client-provisioner | ||
# replace with namespace where provisioner is deployed | ||
namespace: default | ||
roleRef: | ||
kind: ClusterRole | ||
name: nfs-client-provisioner-runner | ||
apiGroup: rbac.authorization.k8s.io | ||
--- | ||
kind: Role | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: leader-locking-nfs-client-provisioner | ||
# replace with namespace where provisioner is deployed | ||
namespace: default | ||
rules: | ||
- apiGroups: [""] | ||
resources: ["endpoints"] | ||
verbs: ["get", "list", "watch", "create", "update", "patch"] | ||
--- | ||
kind: RoleBinding | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: leader-locking-nfs-client-provisioner | ||
# replace with namespace where provisioner is deployed | ||
namespace: default | ||
subjects: | ||
- kind: ServiceAccount | ||
name: nfs-client-provisioner | ||
# replace with namespace where provisioner is deployed | ||
namespace: default | ||
roleRef: | ||
kind: Role | ||
name: leader-locking-nfs-client-provisioner | ||
apiGroup: rbac.authorization.k8s.io |