Created
May 29, 2021 08:08
-
-
Save amritanshu-pandey/8ab00179c98720cbc28d8bb0c7064426 to your computer and use it in GitHub Desktop.
Create Kubernetes storage class using NFS provisioner
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
kind: Deployment | |
apiVersion: apps/v1 | |
metadata: | |
name: nfs-client-provisioner | |
spec: | |
selector: | |
matchLabels: | |
app: nfs-client-provisioner | |
replicas: 1 | |
strategy: | |
type: Recreate | |
template: | |
metadata: | |
labels: | |
app: nfs-client-provisioner | |
spec: | |
serviceAccountName: nfs-client-provisioner | |
containers: | |
- name: nfs-client-provisioner | |
image: gcr.io/k8s-staging-sig-storage/nfs-subdir-external-provisioner:v4.0.0 | |
volumeMounts: | |
- name: nfs-client-root | |
mountPath: /persistentvolumes | |
env: | |
- name: PROVISIONER_NAME | |
value: <ENTER_PROVISIONER_NAME_HERE> | |
- name: NFS_SERVER | |
value: <NFS_HOST_HERE> | |
- name: NFS_PATH | |
value: <NFS_PATH_HERE> | |
volumes: | |
- name: nfs-client-root | |
nfs: | |
server: <NFS_HOST_HERE> | |
path: <NFS_PATH_HERE> |
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
kind: ServiceAccount | |
apiVersion: v1 | |
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: ["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 | |
--- | |
kind: Role | |
apiVersion: rbac.authorization.k8s.io/v1 | |
metadata: | |
name: leader-locking-nfs-client-provisioner | |
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 | |
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 |
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
apiVersion: storage.k8s.io/v1 | |
kind: StorageClass | |
metadata: | |
name: managed-nfs-storage | |
annotations: | |
storageclass.kubernetes.io/is-default-class: "true" | |
provisioner: <ENTER_PROVISIONER_NAME_HERE> | |
parameters: | |
archiveOnDelete: "true" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment