--- apiVersion: v1 kind: ServiceAccount metadata: name: vm-agent namespace: vm-ns # Change the Namespace to where vm-agent is expected to run. --- kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1 metadata: name: vm-agent rules: # antrea-controller distributes the CA certificate as a ConfigMap named `antrea-ca` in the Antrea deployment Namespace. # vm-agent needs to access `antrea-ca` to connect with antrea-controller. - apiGroups: - "" resources: - configmaps resourceNames: - antrea-ca verbs: - get - watch - list # This is the content of built-in role kube-system/extension-apiserver-authentication-reader. # But it doesn't have list/watch permission before K8s v1.17.0 so the extension apiserver (vm-agent) will # have permission issue after bumping up apiserver library to a version that supports dynamic authentication. # See https://github.com/kubernetes/kubernetes/pull/85375 # To support K8s clusters older than v1.17.0, we grant the required permissions directly instead of relying on # the extension-apiserver-authentication role. - apiGroups: - "" resourceNames: - extension-apiserver-authentication resources: - configmaps verbs: - get - list - watch - apiGroups: - crd.antrea.io resources: - antreaagentinfos verbs: - get - update - apiGroups: - controlplane.antrea.io resources: - networkpolicies - appliedtogroups - addressgroups verbs: - get - watch - list - apiGroups: - controlplane.antrea.io resources: - nodestatssummaries verbs: - create - apiGroups: - controlplane.antrea.io resources: - networkpolicies/status verbs: - create - get --- kind: ClusterRoleBinding apiVersion: rbac.authorization.k8s.io/v1 metadata: name: vm-agent roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: vm-agent subjects: - kind: ServiceAccount name: vm-agent namespace: vm-ns # Change the Namespace to where vm-agent is expected to run. --- kind: Role apiVersion: rbac.authorization.k8s.io/v1 metadata: name: vm-agent namespace: vm-ns # Change the Namespace to where vm-agent is expected to run. rules: - apiGroups: - crd.antrea.io resources: - externalnodes verbs: - get - watch - list --- kind: RoleBinding apiVersion: rbac.authorization.k8s.io/v1 metadata: name: vm-agent namespace: vm-ns # Change the Namespace to where vm-agent is expected to run. roleRef: apiGroup: rbac.authorization.k8s.io kind: Role name: vm-agent subjects: - kind: ServiceAccount name: vm-agent namespace: vm-ns # Change the Namespace to where vm-agent is expected to run.