Reading a Specified ClusterRole

Function

This API is used to read a specified ClusterRole.

URL

GET /apis/rbac.authorization.k8s.io/v1/clusterroles/{name}

Table 1 describes the parameters of this API.

Table 1 Parameter description

Parameter

Mandatory

Description

name

Yes

Name of the ClusterRole.

pretty

No

If 'true', then the output is pretty printed.

Request

N/A

Response

Response parameters:

For the description about response parameters, see Table 2.

Example response:

{
    "kind" : "ClusterRole",
    "apiVersion" : "rbac.authorization.k8s.io/v1",
    "metadata" : {
        "name" : "secret-reader",
        "selfLink" : "/apis/rbac.authorization.k8s.io/v1/clusterroles/secret-reader",
        "uid" : "f2cf199e-f1f0-11e8-b449-fa163ec24e06",
        "resourceVersion" : "13211",
        "creationTimestamp" : "2018-11-27T03:03:00Z"
    },
    "rules" : [ {
        "verbs" : [ "get", "watch", "list" ],
        "apiGroups" : [ "" ],
        "resources" : [ "secrets" ]
    } ]
}

Status Code

Table 2 describes the status code of this API.

Table 2 Status code

Status Code

Description

200

OK

For the description about error status codes, see Status Code.