Obtaining the kubeconfig of a Cluster
Function
This API is used to obtain the kubeconfig of a cluster.
URI
POST /v1/clusters/{clusterid}/kubeconfig
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
clusterid |
Yes |
String |
Cluster ID |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
No |
String |
Identity authentication information. Requests for calling an API can be authenticated using either a token or AK/SK. If token-based authentication is used, this parameter is mandatory and must be set to a user token. |
Response Parameters
Status code: 201
|
Parameter |
Type |
Description |
|---|---|---|
|
kind |
String |
API type. The value is fixed at Config and cannot be changed. |
|
apiVersion |
String |
API version. The value is fixed at v1 and cannot be changed. |
|
clusters |
Array of NamedCluster objects |
Cluster list |
|
users |
Array of NamedAuthInfo objects |
Certificate information and client key information of a specified user |
|
contexts |
Array of NamedContext objects |
Context list |
|
current-context |
String |
Current context |
|
Parameter |
Type |
Description |
|---|---|---|
|
name |
String |
Cluster name |
|
cluster |
ClusterCert object |
Cluster information |
|
Parameter |
Type |
Description |
|---|---|---|
|
server |
String |
Server address |
|
certificate-authority-data |
String |
Certificate authorization data |
|
insecure-skip-tls-verify |
String |
Whether to skip server certificate verification |
|
Parameter |
Type |
Description |
|---|---|---|
|
name |
String |
User name |
|
user |
AuthInfo object |
Certificate information and client key information of a specified user |
|
Parameter |
Type |
Description |
|---|---|---|
|
client-certificate-data |
String |
Client certificate |
|
client-key-data |
String |
PEM encoding data from the TLS client key file |
|
token |
String |
Authentication token |
|
Parameter |
Type |
Description |
|---|---|---|
|
name |
String |
Context name |
|
context |
Context object |
Context information |
Status code: 400
|
Parameter |
Type |
Description |
|---|---|---|
|
- |
String |
- |
Status code: 404
|
Parameter |
Type |
Description |
|---|---|---|
|
- |
String |
- |
Status code: 500
|
Parameter |
Type |
Description |
|---|---|---|
|
- |
String |
- |
Example Requests
Obtaining the kubeconfig of a specific cluster
POST https://ucs.myhuaweicloud.com/v1/clusters/{clusterid}/kubeconfig
Example Responses
Status code: 201
The kubeconfig of the cluster obtained
{
"kind" : "Config",
"apiVersion" : "v1",
"clusters" : [ {
"name" : "internalCluster",
"cluster" : {
"server" : "https://192.168.0.18:5443",
"certificate-authority-data" : "*****"
}
}, {
"name" : "externalCluster",
"cluster" : {
"server" : "https://100.93.8.56:5443",
"insecure-skip-tls-verify" : true
}
}, {
"name" : "externalClusterTLSVerify",
"cluster" : {
"server" : "https://100.93.8.56:5443",
"certificate-authority-data" : "******"
}
} ],
"users" : [ {
"name" : "user",
"user" : {
"client-certificate-data" : "******",
"client-key-data" : "******"
}
} ],
"contexts" : [ {
"name" : "internal",
"context" : {
"cluster" : "internalCluster",
"user" : "user"
}
}, {
"name" : "external",
"context" : {
"cluster" : "externalCluster",
"user" : "user"
}
}, {
"name" : "externalTLSVerify",
"context" : {
"cluster" : "externalClusterTLSVerify",
"user" : "user"
}
} ],
"current-context" : "external"
}
Status Codes
|
Status Code |
Description |
|---|---|
|
201 |
The kubeconfig of the cluster obtained |
|
400 |
Client request error. The server could not execute the request. |
|
404 |
Resources not found |
|
500 |
Internal server error |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot