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.

Table 2 Response parameters

Parameter

Type

Description

apiVersion

String

APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values.

kind

String

Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase.

metadata

metadata object

Standard object's metadata.

rules

rules object

Rules holds all the PolicyRules for this ClusterRole.

Table 3 Data structure of the metadata field

Parameter

Type

Description

name

String

Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated.

selfLink

String

SelfLink is a URL representing this object. Populated by the system. Read-only.

uid

String

UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations. Populated by the system. Read-only.

resourceVersion

String

An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources. Populated by the system. Read-only.

creationTimestamp

String

CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC. Populated by the system. Read-only. Null for lists.

Table 4 Data structure of the rules field

Parameter

Type

Description

apiGroups

Array of strings

APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed.

resources

Array of strings

Resources is a list of resources this rule applies to. ResourceAll represents all resources.

verbs

Array of strings

Verbs is a list of Verbs that apply to ALL the ResourceKinds and AttributeRestrictions contained in this rule. VerbAll represents all kinds.

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 5 describes the status code of this API.

Table 5 Status code

Status Code

Description

200

OK

For more status codes, see Status Codes.