You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If your cluster has the API enabled, you can use the `SelfSubjectReview` API to find out how your Kubernetes cluster maps your authentication information to identify you as a client. This works whether you are authenticating as a user (typically representing a real person) or as a ServiceAccount.
1999
+
2000
+
`SelfSubjectReview`objects do not have any configurable fields. On receiving a request, the Kubernetes API server fills the status with the user attributes and returns it to the user.
2001
+
2002
+
Request example (the body would be a `SelfSubjectReview`):
2003
+
-->
2004
+
如果集群启用了此 API,你可以使用 `SelfSubjectReview` API 来了解 Kubernetes
2005
+
集群如何映射你的身份验证信息从而将你识别为某客户端。无论你是作为用户(通常代表一个真的人)还是作为
2006
+
ServiceAccount 进行身份验证,这一 API 都可以使用。
2007
+
2008
+
`SelfSubjectReview`对象没有任何可配置的字段。
2009
+
Kubernetes API 服务器收到请求后,将使用用户属性填充 status 字段并将其返回给用户。
2010
+
2011
+
请求示例(主体将是 `SelfSubjectReview`):
2012
+
2013
+
```
2014
+
POST /apis/authentication.k8s.io/v1alpha1/selfsubjectreviews
2015
+
```
2016
+
2017
+
```json
2018
+
{
2019
+
"apiVersion": "authentication.k8s.io/v1alpha1",
2020
+
"kind": "SelfSubjectReview"
2021
+
}
2022
+
```
2023
+
2024
+
<!--
2025
+
Response example:
2026
+
-->
2027
+
响应示例:
2028
+
2029
+
```json
2030
+
{
2031
+
"apiVersion": "authentication.k8s.io/v1alpha1",
2032
+
"kind": "SelfSubjectReview",
2033
+
"status": {
2034
+
"userInfo": {
2035
+
"name": "jane.doe",
2036
+
"uid": "b6c7cfd4-f166-11ec-8ea0-0242ac120002",
2037
+
"groups": [
2038
+
"viewers",
2039
+
"editors",
2040
+
"system:authenticated"
2041
+
],
2042
+
"extra": {
2043
+
"provider_id": ["token.company.example"]
2044
+
}
2045
+
}
2046
+
}
2047
+
}
2048
+
```
2049
+
2050
+
<!--
2051
+
For convenience, the `kubectl alpha auth whoami` command is present. Executing this command will produce the following output (yet different user attributes will be shown):
This feature is extremely useful when a complicated authentication flow is used in a Kubernetes cluster,
2141
+
for example, if you use [webhook token authentication](/docs/reference/access-authn-authz/authentication/#webhook-token-authentication) or [authenticating proxy](/docs/reference/access-authn-authz/authentication/#authenticating-proxy).
By default, all authenticated users can create `SelfSubjectReview` objects when the `APISelfSubjectReview` feature is enabled. It is allowed by the `system:basic-user` cluster role.
0 commit comments