kind: ServiceAccount apiVersion: v1 metadata: name: vsphere-csi-controller namespace: kube-system --- kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1 metadata: name: vsphere-csi-controller-role rules: - apiGroups: [""] resources: ["nodes", "persistentvolumeclaims", "pods", "configmaps"] verbs: ["get", "list", "watch"] {% if external_vsphere_version >= "7.0" %} - apiGroups: [""] resources: ["persistentvolumeclaims/status"] {% if external_vsphere_version >= "7.0u1" %} verbs: ["patch"] {% else %} verbs: ["update", "patch"] {% endif %} {% endif %} - apiGroups: [""] resources: ["persistentvolumes"] verbs: ["get", "list", "watch", "create", "update", "delete", "patch"] - apiGroups: [""] resources: ["events"] verbs: ["get", "list", "watch", "create", "update", "patch"] {% if vsphere_csi_controller is version('v2.0.0', '>=') %} - apiGroups: ["coordination.k8s.io"] resources: ["leases"] verbs: ["get", "watch", "list", "delete", "update", "create"] {% endif %} - apiGroups: ["storage.k8s.io"] resources: ["storageclasses","csinodes"] verbs: ["get", "list", "watch"] - apiGroups: ["storage.k8s.io"] resources: ["volumeattachments"] verbs: ["get", "list", "watch", "patch"] {% if external_vsphere_version >= "7.0u1" %} - apiGroups: ["cns.vmware.com"] resources: ["cnsvspherevolumemigrations"] verbs: ["create", "get", "list", "watch", "update", "delete"] - apiGroups: ["apiextensions.k8s.io"] resources: ["customresourcedefinitions"] verbs: ["get", "create"] {% endif %} {% if vsphere_csi_controller is version('v2.0.0', '>=') %} - apiGroups: ["storage.k8s.io"] resources: ["volumeattachments/status"] verbs: ["patch"] {% endif %} --- kind: ClusterRoleBinding apiVersion: rbac.authorization.k8s.io/v1 metadata: name: vsphere-csi-controller-binding subjects: - kind: ServiceAccount name: vsphere-csi-controller namespace: kube-system roleRef: kind: ClusterRole name: vsphere-csi-controller-role apiGroup: rbac.authorization.k8s.io