Downloading Federation kubeconfig

Function

This API is used to download the kubeconfig after the cluster federation is enabled for a fleet and the federation connection is created.

URI

POST /v1/clustergroups/{clustergroupid}/kubeconfig

Table 1 Path parameter

Parameter

Mandatory

Type

Description

clustergroupid

Yes

String

Fleet ID

Request Parameters

Table 2 Parameters in the request header

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

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.

Content-Type

Yes

String

Message body type (format). Only application/json is supported.

Table 3 Parameter in the request body

Parameter

Mandatory

Type

Description

duration

Yes

Integer

Validity period of the certificate in kubeconfig

Minimum value: 1

Maximum value: 1825

Response Parameters

Status code: 201

Table 4 Parameters in the response body

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 specified users

contexts

Array of NamedContext objects

Context list

current-context

String

Current context

Table 5 NamedCluster

Parameter

Type

Description

name

String

Cluster name

cluster

ClusterCert object

Cluster information

Table 6 ClusterCert

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

Table 7 NamedAuthInfo

Parameter

Type

Description

name

String

Username

user

AuthInfo object

Certificate information and client key information of a specified user

Table 8 AuthInfo

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

Table 9 NamedContext

Parameter

Type

Description

name

String

Context name

context

Context object

Context information

Table 10 Context

Parameter

Type

Description

cluster

String

Cluster context

user

String

User context

Example Requests

Downloading federation kubeconfig

{
  "duration" : 30
}

Example Responses

Status code: 201

kubeconfig file

{
  "kind" : "Config",
  "apiVersion" : "v1",
  "clusters" : [ {
    "name" : "cluster-demo",
    "cluster" : {
      "server" : "https://ip:port",
      "certificate-authority-data" : ""
    }
  } ],
  "users" : [ {
    "name" : "user",
    "user" : {
      "client-certificate-data" : "",
      "client-key-data" : "",
      "token" : ""
    }
  } ],
  "contexts" : [ {
    "name" : "demo",
    "context" : {
      "cluster" : "cluster-demo",
      "user" : "user"
    }
  } ],
  "current-context" : "demo"
}

Status Codes

Status Code

Description

201

kubeconfig file

Error Codes

See Error Codes.