Skip to content

Commit

Permalink
fix rbac issue
Browse files Browse the repository at this point in the history
  • Loading branch information
chenxingyu committed Aug 8, 2017
1 parent c21d68c commit 1dff559
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 10 deletions.
11 changes: 2 additions & 9 deletions kubernetes/kube-state-metrics-cluster-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,20 @@ kind: ClusterRole
metadata:
name: kube-state-metrics
rules:
- apiGroups: [""]
resources:
- pods
verbs: ["list", "watch", "get"]
- apiGroups: [""]
resources:
- nodes
- pods
- services
- resourcequotas
- replicationcontrollers
- limitranges
- persistentvolumeclaims
verbs: ["list", "watch"]
- apiGroups: ["extensions"]
resources:
- deployments
verbs: ["list", "watch", "get", "update"]
- apiGroups: ["extensions"]
resources:
- daemonsets
- deployments
- replicasets
verbs: ["list", "watch"]
- apiGroups: ["apps"]
Expand All @@ -34,4 +28,3 @@ rules:
- cronjobs
- jobs
verbs: ["list", "watch"]

2 changes: 1 addition & 1 deletion kubernetes/kube-state-metrics-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
limits:
memory: 50Mi
cpu: 200m
- name: pod-nanny
- name: addon-resizer
image: gcr.io/google_containers/addon-resizer:1.0
resources:
limits:
Expand Down
14 changes: 14 additions & 0 deletions kubernetes/kube-state-metrics-role-binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
name: kube-state-metrics
namespace: kube-system
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: kube-state-metrics-resizer
subjects:
- kind: ServiceAccount
name: kube-state-metrics
namespace: kube-system

16 changes: 16 additions & 0 deletions kubernetes/kube-state-metrics-role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: Role
metadata:
namespace: kube-system
name: kube-state-metrics-resizer
rules:
- apiGroups: [""]
resources:
- pods
verbs: ["get"]
- apiGroups: ["extensions"]
resources:
- deployments
resourceNames: ["kube-state-metrics"]
verbs: ["get", "update"]

0 comments on commit 1dff559

Please sign in to comment.