|
| 1 | +--- |
| 2 | +api_metadata: |
| 3 | + apiVersion: "authentication.k8s.io/v1" |
| 4 | + import: "k8s.io/api/authentication/v1" |
| 5 | + kind: "TokenRequest" |
| 6 | +content_type: "api_reference" |
| 7 | +description: "TokenRequest 为给定的服务账号请求一个令牌。" |
| 8 | +title: "TokenRequest" |
| 9 | +weight: 2 |
| 10 | +--- |
| 11 | +<!-- |
| 12 | +api_metadata: |
| 13 | + apiVersion: "authentication.k8s.io/v1" |
| 14 | + import: "k8s.io/api/authentication/v1" |
| 15 | + kind: "TokenRequest" |
| 16 | +content_type: "api_reference" |
| 17 | +description: "TokenRequest requests a token for a given service account." |
| 18 | +title: "TokenRequest" |
| 19 | +weight: 2 |
| 20 | +auto_generated: true |
| 21 | +--> |
| 22 | + |
| 23 | +`apiVersion: authentication.k8s.io/v1` |
| 24 | + |
| 25 | +`import "k8s.io/api/authentication/v1"` |
| 26 | + |
| 27 | +## TokenRequest {#TokenRequest} |
| 28 | +<!-- |
| 29 | +TokenRequest requests a token for a given service account. |
| 30 | +--> |
| 31 | +TokenRequest 为给定的服务账号请求一个令牌。 |
| 32 | + |
| 33 | +<hr> |
| 34 | + |
| 35 | +- **apiVersion**: authentication.k8s.io/v1 |
| 36 | + |
| 37 | +- **kind**: TokenRequest |
| 38 | + |
| 39 | +<!-- |
| 40 | +- **metadata** (<a href="{{< ref "../common-definitions/object-meta#ObjectMeta" >}}">ObjectMeta</a>) |
| 41 | + Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata |
| 42 | +
|
| 43 | +- **spec** (<a href="{{< ref "../authentication-resources/token-request-v1#TokenRequestSpec" >}}">TokenRequestSpec</a>), required |
| 44 | + Spec holds information about the request being evaluated |
| 45 | +- **status** (<a href="{{< ref "../authentication-resources/token-request-v1#TokenRequestStatus" >}}">TokenRequestStatus</a>) |
| 46 | +
|
| 47 | + Status is filled in by the server and indicates whether the token can be authenticated. |
| 48 | +--> |
| 49 | +- **metadata** (<a href="{{< ref "../common-definitions/object-meta#ObjectMeta" >}}">ObjectMeta</a>) |
| 50 | + |
| 51 | + 标准的对象元数据。更多信息: |
| 52 | + https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata |
| 53 | + |
| 54 | +- **spec** (<a href="{{< ref "../authentication-resources/token-request-v1#TokenRequestSpec" >}}">TokenRequestSpec</a>),必需 |
| 55 | + |
| 56 | + spec 包含与正被评估的请求相关的信息。 |
| 57 | + |
| 58 | +- **status** (<a href="{{< ref "../authentication-resources/token-request-v1#TokenRequestStatus" >}}">TokenRequestStatus</a>) |
| 59 | + |
| 60 | + status 由服务器填充,表示该令牌是否可用于身份认证。 |
| 61 | + |
| 62 | +## TokenRequestSpec {#TokenRequestSpec} |
| 63 | +<!-- |
| 64 | +TokenRequestSpec contains client provided parameters of a token request. |
| 65 | +--> |
| 66 | +TokenRequestSpec 包含客户端提供的令牌请求参数。 |
| 67 | + |
| 68 | +<hr> |
| 69 | + |
| 70 | +<!-- |
| 71 | +- **audiences** ([]string), required |
| 72 | +
|
| 73 | + Audiences are the intendend audiences of the token. A recipient of a token must identitfy themself with an identifier in the list of audiences of the token, and otherwise should reject the token. A token issued for multiple audiences may be used to authenticate against any of the audiences listed but implies a high degree of trust between the target audiences. |
| 74 | +--> |
| 75 | +- **audiences** ([]string),必需 |
| 76 | + |
| 77 | + audiences 是令牌预期的受众。 |
| 78 | + 令牌的接收方必须在令牌的受众列表中用一个标识符来标识自己,否则应拒绝该令牌。 |
| 79 | + 为多个受众签发的令牌可用于认证所列举的任意受众的身份,但这意味着目标受众彼此之间的信任程度较高。 |
| 80 | + |
| 81 | +- **boundObjectRef** (BoundObjectReference) |
| 82 | + |
| 83 | + <!-- |
| 84 | + BoundObjectRef is a reference to an object that the token will be bound to. The token will only be valid for as long as the bound object exists. NOTE: The API server's TokenReview endpoint will validate the BoundObjectRef, but other audiences may not. Keep ExpirationSeconds small if you want prompt revocation. |
| 85 | +
|
| 86 | + <a name="BoundObjectReference"></a> |
| 87 | + *BoundObjectReference is a reference to an object that a token is bound to.* |
| 88 | + --> |
| 89 | + boundObjectRef 是对令牌所绑定的一个对象的引用。该令牌只有在绑定对象存在时才有效。 |
| 90 | + 注:API 服务器的 TokenReview 端点将校验 boundObjectRef,但其他受众可能不用这样。 |
| 91 | + 如果你想要快速撤销,请为 expirationSeconds 设一个较小的值。 |
| 92 | + |
| 93 | + <a name="BoundObjectReference"></a> |
| 94 | + **BoundObjectReference 是对令牌所绑定的一个对象的引用。** |
| 95 | + |
| 96 | + <!-- |
| 97 | + - **boundObjectRef.apiVersion** (string) |
| 98 | + API version of the referent. |
| 99 | +
|
| 100 | + - **boundObjectRef.kind** (string) |
| 101 | + Kind of the referent. Valid kinds are 'Pod' and 'Secret'. |
| 102 | +
|
| 103 | + - **boundObjectRef.name** (string) |
| 104 | + Name of the referent. |
| 105 | + |
| 106 | + - **boundObjectRef.uid** (string) |
| 107 | + UID of the referent. |
| 108 | + --> |
| 109 | + - **boundObjectRef.apiVersion** (string) |
| 110 | + |
| 111 | + 引用对象的 API 版本。 |
| 112 | + |
| 113 | + - **boundObjectRef.kind** (string) |
| 114 | + |
| 115 | + 引用对象的类别。有效的类别为 “Pod” 和 “Secret”。 |
| 116 | + |
| 117 | + - **boundObjectRef.name** (string) |
| 118 | + |
| 119 | + 引用对象的名称。 |
| 120 | + |
| 121 | + - **boundObjectRef.uid** (string) |
| 122 | + 引用对象的 UID。 |
| 123 | + |
| 124 | +<!-- |
| 125 | +- **expirationSeconds** (int64) |
| 126 | +
|
| 127 | + ExpirationSeconds is the requested duration of validity of the request. The token issuer may return a token with a different validity duration so a client needs to check the 'expiration' field in a response. |
| 128 | +--> |
| 129 | +- **expirationSeconds** (int64) |
| 130 | + |
| 131 | + expirationSeconds 是请求生效的持续时间。 |
| 132 | + 令牌签发方可能返回一个生效期不同的令牌,因此客户端需要检查响应中的 “expiration” 字段。 |
| 133 | + |
| 134 | +## TokenRequestStatus {#TokenRequestStatus} |
| 135 | +<!-- |
| 136 | +TokenRequestStatus is the result of a token request. |
| 137 | +--> |
| 138 | +TokenRequestStatus 是一个令牌请求的结果。 |
| 139 | + |
| 140 | +<hr> |
| 141 | + |
| 142 | +<!-- |
| 143 | +- **expirationTimestamp** (Time), required |
| 144 | + ExpirationTimestamp is the time of expiration of the returned token. |
| 145 | +
|
| 146 | + <a name="Time"></a> |
| 147 | + *Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.* |
| 148 | +
|
| 149 | +- **token** (string), required |
| 150 | + Token is the opaque bearer token. |
| 151 | +--> |
| 152 | +- **expirationTimestamp** (Time),必需 |
| 153 | + |
| 154 | + expirationTimestamp 是已返回令牌的到期时间。 |
| 155 | + |
| 156 | + <a name="Time"></a> |
| 157 | + **Time 是 time.Time 的包装器,支持正确编组为 YAML 和 JSON。为 time 包提供的许多工厂方法提供了包装器。** |
| 158 | + |
| 159 | +- **token** (string),必需 |
| 160 | + |
| 161 | + token 是不透明的持有者令牌(Bearer Token)。 |
| 162 | + |
| 163 | +<!-- |
| 164 | +## Operations {#Operations} |
| 165 | +<hr> |
| 166 | +### `create` create token of a ServiceAccount |
| 167 | +#### HTTP Request |
| 168 | +--> |
| 169 | +## 操作 {#Operations} |
| 170 | +<hr> |
| 171 | + |
| 172 | +### `create` 创建 ServiceAccount 的令牌 |
| 173 | +#### HTTP 请求 |
| 174 | +POST /api/v1/namespaces/{namespace}/serviceaccounts/{name}/token |
| 175 | + |
| 176 | +<!-- |
| 177 | +#### Parameters |
| 178 | +- **name** (*in path*): string, required |
| 179 | + name of the TokenRequest |
| 180 | +- **namespace** (*in path*): string, required |
| 181 | +- **body**: <a href="{{< ref "../authentication-resources/token-request-v1#TokenRequest" >}}">TokenRequest</a>, required |
| 182 | +- **dryRun** (*in query*): string |
| 183 | +- **fieldManager** (*in query*): string |
| 184 | +- **fieldValidation** (*in query*): string |
| 185 | +- **pretty** (*in query*): string |
| 186 | +--> |
| 187 | +#### 参数 |
| 188 | +- **name** (**路径参数**): string,必需 |
| 189 | + |
| 190 | + TokenRequest 的名称 |
| 191 | + |
| 192 | +- **namespace** (**路径参数**): string,必需 |
| 193 | + |
| 194 | + <a href="{{< ref "../common-parameters/common-parameters#namespace" >}}">namespace</a> |
| 195 | + |
| 196 | +- **body**: <a href="{{< ref "../authentication-resources/token-request-v1#TokenRequest" >}}">TokenRequest</a>,必需 |
| 197 | + |
| 198 | +- **dryRun** (**查询参数**): string |
| 199 | + |
| 200 | + <a href="{{< ref "../common-parameters/common-parameters#dryRun" >}}">dryRun</a> |
| 201 | + |
| 202 | +- **fieldManager** (**查询参数**): string |
| 203 | + |
| 204 | + <a href="{{< ref "../common-parameters/common-parameters#fieldManager" >}}">fieldManager</a> |
| 205 | + |
| 206 | +- **fieldValidation** (**查询参数**): string |
| 207 | + |
| 208 | + <a href="{{< ref "../common-parameters/common-parameters#fieldValidation" >}}">fieldValidation</a> |
| 209 | + |
| 210 | +- **pretty** (**查询参数**): string |
| 211 | + |
| 212 | + <a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty</a> |
| 213 | + |
| 214 | +<!-- |
| 215 | +#### Response |
| 216 | +--> |
| 217 | +#### 响应 |
| 218 | +200 (<a href="{{< ref "../authentication-resources/token-request-v1#TokenRequest" >}}">TokenRequest</a>): OK |
| 219 | + |
| 220 | +201 (<a href="{{< ref "../authentication-resources/token-request-v1#TokenRequest" >}}">TokenRequest</a>): Created |
| 221 | + |
| 222 | +202 (<a href="{{< ref "../authentication-resources/token-request-v1#TokenRequest" >}}">TokenRequest</a>): Accepted |
| 223 | + |
| 224 | +401: Unauthorized |
| 225 | + |
0 commit comments