You can call the DescribeClusterUserKubeconfig operation to query the kubeconfig file of a Container Service for Kubernetes (ACK) cluster. The kubeconfig file contains the details of the current user and is used to configure access to a cluster.
Debugging
Request syntax
GET /k8s/ClusterId/user_config?PrivateIpAddress=Boolean&TemporaryDurationMinutes=Long HTTP/1.1
Content-Type:application/json
Request parameters
Parameter | Type | Required | Example | Description |
ClusterId | String | Yes | c5b5e80b0b64a4bf6939d2d8fbbc5**** | The ID of the ACK cluster that you want to query |
Parameter | Type | Required | Example | Description |
PrivateIpAddress | Boolean | No | true | Specifies whether to obtain the credential that is used to connect to the cluster over the internal network. Valid values:
Default value: |
TemporaryDurationMinutes | Long | No | 15 | The validity period of a temporary kubeconfig file. Unit: minutes. Valid values: 15 to 4320. Note If you do not specify this parameter, the system automatically specifies a validity period, which is indicated by the expiration field in the response. |
Response syntax
HTTP/1.1 200 OK
Content-Type:application/json
{
"config" : "String",
"expiration" : "String"
}
Response parameters
Parameter | Type | Example | Description |
config | String | apiVersion: v1**** | The content of the kubeconfig file. For more information about the content of the kubeconfig file, see Configure cluster credentials. |
expiration | String | 2024-03-10T09:56:17Z | The expiration time of the kubeconfig file. The value is the UTC time displayed in RFC3339 format. |
Examples
Sample requests
GET /k8s/c5b5e80b0b64a4bf6939d2d8fbbc5****/user_config?PrivateIpAddress=true&TemporaryDurationMinutes=15 HTTP/1.1
Host:cs.aliyuncs.com
Content-Type:application/json
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<config>
apiVersion: v1
clusters:
- cluster:
...
</config>
<expiration>2021-03-25T10:01:20Z</expiration>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"config" : "\napiVersion: v1\nclusters:\n- cluster:\n...\n",
"expiration" : "2021-03-25T10:01:20Z"
}
Error codes
For a list of error codes, visit the API Error Center.