Granular RBAC
frezbo opened this issue · 1 comments
frezbo commented
The current ccm RBAC permissions is a little bit wide open
This is the modified RBAC I use with kube-vip-ccm (I have only tested the k8s service VIP functionality using ARP only)
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: kube-vip-cloud-controller
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
annotations:
rbac.authorization.kubernetes.io/autoupdate: "true"
name: kube-vip-cloud-controller-role
namespace: kube-system
rules:
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["get", "create"]
- apiGroups: [""]
resources: ["endpoints"]
resourceNames: ["kube-vip-cloud-controller"]
verbs: ["update"]
- apiGroups: ["coordination.k8s.io"]
resources: ["leases"]
verbs: ["get", "create"]
- apiGroups: ["coordination.k8s.io"]
resources: ["leases"]
resourceNames: ["kube-vip-cloud-controller"]
verbs: ["update"]
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: system:kube-vip-cloud-controller-binding
namespace: kube-system
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: kube-vip-cloud-controller-role
subjects:
- kind: ServiceAccount
name: kube-vip-cloud-controller
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
annotations:
rbac.authorization.kubernetes.io/autoupdate: "true"
name: system:kube-vip-cloud-controller-role
rules:
- apiGroups: [""]
resources: ["services"]
verbs: ["watch", "list", "update"]
- apiGroups: [""]
resources: ["nodes"]
verbs: ["list", "watch"]
- apiGroups: [""]
resources: ["events"]
verbs: ["create", "patch"]
- apiGroups: [""]
resources: ["services/status"]
verbs: ["patch"]
- apiGroups: [""]
resources: ["configmaps"]
verbs: ["create"]
- apiGroups: [""]
resources: ["configmaps"]
resourceNames: ["kubevip"]
verbs: ["*"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: system:kube-vip-cloud-controller-binding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: system:kube-vip-cloud-controller-role
subjects:
- kind: ServiceAccount
name: kube-vip-cloud-controller
namespace: kube-system
Happy to do a PR is this is reasonable
thebsdbox commented
Yeah, a PR would be great