File tree Expand file tree Collapse file tree 3 files changed +23
-25
lines changed
docs/reference/access-authn-authz Expand file tree Collapse file tree 3 files changed +23
-25
lines changed Original file line number Diff line number Diff line change @@ -78,17 +78,7 @@ a role cluster-wide, use a ClusterRole.
78
78
Here's an example Role in the "default" namespace that can be used to grant read access to
79
79
{{< glossary_tooltip text="pods" term_id="pod" >}}:
80
80
81
- ``` yaml
82
- apiVersion : rbac.authorization.k8s.io/v1
83
- kind : Role
84
- metadata :
85
- namespace : default
86
- name : pod-reader
87
- rules :
88
- - apiGroups : [""] # "" indicates the core API group
89
- resources : ["pods"]
90
- verbs : ["get", "watch", "list"]
91
- ` ` `
81
+ {{% code_sample file="access/simple-role.yaml" %}}
92
82
93
83
#### ClusterRole example
94
84
@@ -106,20 +96,7 @@ Here is an example of a ClusterRole that can be used to grant read access to
106
96
{{< glossary_tooltip text="secrets" term_id="secret" >}} in any particular namespace,
107
97
or across all namespaces (depending on how it is [ bound] ( #rolebinding-and-clusterrolebinding ) ):
108
98
109
- ` ` ` yaml
110
- apiVersion: rbac.authorization.k8s.io/v1
111
- kind: ClusterRole
112
- metadata:
113
- # "namespace" omitted since ClusterRoles are not namespaced
114
- name: secret-reader
115
- rules:
116
- - apiGroups: [""]
117
- #
118
- # at the HTTP level, the name of the resource for accessing Secret
119
- # objects is "secrets"
120
- resources: ["secrets"]
121
- verbs: ["get", "watch", "list"]
122
- ` ` `
99
+ {{% code_sample file="access/simple-clusterrole.yaml" %}}
123
100
124
101
The name of a Role or a ClusterRole object must be a valid
125
102
[ path segment name] ( /docs/concepts/overview/working-with-objects/names#path-segment-names ) .
Original file line number Diff line number Diff line change
1
+ apiVersion : rbac.authorization.k8s.io/v1
2
+ kind : ClusterRole
3
+ metadata :
4
+ # "namespace" omitted since ClusterRoles are not namespaced
5
+ name : secret-reader
6
+ rules :
7
+ - apiGroups : [""]
8
+ #
9
+ # at the HTTP level, the name of the resource for accessing Secret
10
+ # objects is "secrets"
11
+ resources : ["secrets"]
12
+ verbs : ["get", "watch", "list"]
Original file line number Diff line number Diff line change
1
+ apiVersion : rbac.authorization.k8s.io/v1
2
+ kind : Role
3
+ metadata :
4
+ namespace : default
5
+ name : pod-reader
6
+ rules :
7
+ - apiGroups : [""] # "" indicates the core API group
8
+ resources : ["pods"]
9
+ verbs : ["get", "watch", "list"]
You can’t perform that action at this time.
0 commit comments