-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
78cd106
commit a3c3411
Showing
14 changed files
with
507 additions
and
286 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Aggregated ClusterRoles | ||
|
||
Inspect individual ClusterRoles | ||
|
||
```sh | ||
kubectl get clusterrole -l rbac.authorization.k8s.io/aggregate-to-view=true | ||
``` | ||
|
||
Create first ClusterRole | ||
|
||
```sh | ||
cat <<EOF | kubectl apply -f - | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: monitoring-endpoints | ||
labels: | ||
aggregate-to-monitoring: "true" | ||
rules: | ||
- apiGroups: [""] | ||
resources: ["services", "endpointslices", "pods"] | ||
verbs: ["get", "list", "watch"] | ||
EOF | ||
``` | ||
|
||
Create second ClusterRole | ||
|
||
```sh | ||
cat <<EOF | kubectl apply -f - | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: monitoring-deployments | ||
labels: | ||
aggregate-to-monitoring: "true" | ||
rules: | ||
- apiGroups: ["apps"] | ||
resources: ["deployments"] | ||
verbs: ["get", "list", "watch"] | ||
EOF | ||
``` | ||
|
||
Display new ClusterRoles | ||
|
||
```sh | ||
kubectl get clusterrole -l aggregate-to-monitoring=true | ||
``` | ||
|
||
Create receiving ClusterRole | ||
|
||
```sh | ||
cat <<EOF | kubectl apply -f - | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: monitoring | ||
aggregationRule: | ||
clusterRoleSelectors: | ||
- matchLabels: | ||
aggregate-to-monitoring: "true" | ||
rules: [] | ||
EOF | ||
``` | ||
|
||
Show aggregated ClusterRole | ||
|
||
```sh | ||
kubectl get clusterrole monitoring -o yaml | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.