sample-apiserver: Add RBAC roles and ClusterRoleBindings for Admission Webhooks

This commit is contained in:
Marko Mudrinić 2018-06-19 09:35:26 +02:00
parent b005f2fba3
commit 33d31e4a55
No known key found for this signature in database
GPG Key ID: F15730C52ACE0E9D
3 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,12 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: sample-apiserver-clusterrolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: aggregated-apiserver-clusterrole
subjects:
- kind: ServiceAccount
name: apiserver
namespace: wardle

View File

@ -0,0 +1,11 @@
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: aggregated-apiserver-clusterrole
rules:
- apiGroups: [""]
resources: ["namespaces"]
verbs: ["get", "watch", "list"]
- apiGroups: ["admissionregistration.k8s.io"]
resources: ["mutatingwebhookconfigurations", "validatingwebhookconfigurations"]
verbs: ["get", "watch", "list"]

View File

@ -78,6 +78,10 @@ kubectl create -f artifacts/example/sa.yaml -n wardle
kubectl create -f artifacts/example/auth-delegator.yaml -n kube-system
kubectl create -f artifacts/example/auth-reader.yaml -n kube-system
# create rbac roles and clusterrolebinding that allow the service account user to use admission webhooks
kubectl create -f artifacts/example/rbac.yaml
kubectl create -f artifacts/example/rbac-bind.yaml
# create the service and replication controller
kubectl create -f artifacts/example/rc.yaml -n wardle
kubectl create -f artifacts/example/service.yaml -n wardle