rbac.yaml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. # This YAML file contains all RBAC objects that are necessary to run external
  2. # CSI provisioner.
  3. #
  4. # In production, each CSI driver deployment has to be customized:
  5. # - to avoid conflicts, use non-default namespace and different names
  6. # for non-namespaced entities like the ClusterRole
  7. # - decide whether the deployment replicates the external CSI
  8. # provisioner, in which case leadership election must be enabled;
  9. # this influences the RBAC setup, see below
  10. apiVersion: v1
  11. kind: ServiceAccount
  12. metadata:
  13. name: csi-provisioner
  14. # replace with non-default namespace name
  15. namespace: default
  16. ---
  17. kind: ClusterRole
  18. apiVersion: rbac.authorization.k8s.io/v1
  19. metadata:
  20. name: external-provisioner-runner
  21. rules:
  22. # The following rule should be uncommented for plugins that require secrets
  23. # for provisioning.
  24. # - apiGroups: [""]
  25. # resources: ["secrets"]
  26. # verbs: ["get", "list"]
  27. - apiGroups: [""]
  28. resources: ["persistentvolumes"]
  29. verbs: ["get", "list", "watch", "create", "delete"]
  30. - apiGroups: [""]
  31. resources: ["persistentvolumeclaims"]
  32. verbs: ["get", "list", "watch", "update"]
  33. - apiGroups: ["storage.k8s.io"]
  34. resources: ["storageclasses"]
  35. verbs: ["get", "list", "watch"]
  36. - apiGroups: [""]
  37. resources: ["events"]
  38. verbs: ["list", "watch", "create", "update", "patch"]
  39. - apiGroups: ["snapshot.storage.k8s.io"]
  40. resources: ["volumesnapshots"]
  41. verbs: ["get", "list"]
  42. - apiGroups: ["snapshot.storage.k8s.io"]
  43. resources: ["volumesnapshotcontents"]
  44. verbs: ["get", "list"]
  45. - apiGroups: ["storage.k8s.io"]
  46. resources: ["csinodes"]
  47. verbs: ["get", "list", "watch"]
  48. - apiGroups: [""]
  49. resources: ["nodes"]
  50. verbs: ["get", "list", "watch"]
  51. ---
  52. kind: ClusterRoleBinding
  53. apiVersion: rbac.authorization.k8s.io/v1
  54. metadata:
  55. name: csi-provisioner-role
  56. subjects:
  57. - kind: ServiceAccount
  58. name: csi-provisioner
  59. # replace with non-default namespace name
  60. namespace: default
  61. roleRef:
  62. kind: ClusterRole
  63. name: external-provisioner-runner
  64. apiGroup: rbac.authorization.k8s.io
  65. ---
  66. # Provisioner must be able to work with endpoints in current namespace
  67. # if (and only if) leadership election is enabled
  68. kind: Role
  69. apiVersion: rbac.authorization.k8s.io/v1
  70. metadata:
  71. # replace with non-default namespace name
  72. namespace: default
  73. name: external-provisioner-cfg
  74. rules:
  75. # Only one of the following rules for endpoints or leases is required based on
  76. # what is set for `--leader-election-type`. Endpoints are deprecated in favor of Leases.
  77. - apiGroups: [""]
  78. resources: ["endpoints"]
  79. verbs: ["get", "watch", "list", "delete", "update", "create"]
  80. - apiGroups: ["coordination.k8s.io"]
  81. resources: ["leases"]
  82. verbs: ["get", "watch", "list", "delete", "update", "create"]
  83. ---
  84. kind: RoleBinding
  85. apiVersion: rbac.authorization.k8s.io/v1
  86. metadata:
  87. name: csi-provisioner-role-cfg
  88. # replace with non-default namespace name
  89. namespace: default
  90. subjects:
  91. - kind: ServiceAccount
  92. name: csi-provisioner
  93. # replace with non-default namespace name
  94. namespace: default
  95. roleRef:
  96. kind: Role
  97. name: external-provisioner-cfg
  98. apiGroup: rbac.authorization.k8s.io