Updated on 2025-07-29 GMT+08:00

Updating a Cluster

Function

This API is used to update a cluster. Currently, only the countries and cities of an attached cluster and an on-premises cluster can be updated.

URI

PUT /v1/clusters/{clusterid}

Table 1 Path parameter

Parameter

Mandatory

Type

Description

clusterid

Yes

String

Cluster ID

Request Parameters

Table 2 Parameter in the request header

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Identity authentication information

Table 3 Parameters in the request body

Parameter

Mandatory

Type

Description

kind

Yes

String

API type. The value is fixed at Cluster and cannot be changed.

apiVersion

Yes

String

API version. The value is fixed at v1 and cannot be changed.

metadata

No

ObjectMeta object

Basic information about the cluster. Metadata is a collection of attributes.

spec

No

UpdateClusterSpec object

Details about the cluster. UCS creates or updates the cluster based on spec.

Table 4 ObjectMeta

Parameter

Mandatory

Type

Description

uid

No

String

Cluster ID

name

No

String

Cluster name

labels

No

Map<String,String>

Labels

creationTimestamp

No

String

Creation time. It is a UTC time in the RFC 3339 format.

updateTimestamp

No

String

Update timestamp

Table 5 UpdateClusterSpec

Parameter

Mandatory

Type

Description

country

No

String

Country where the cluster is located

city

No

String

City where the cluster is located

Table 6 WorkerConfig

Parameter

Mandatory

Type

Description

replicas

No

Integer

The number of nodes

strategy

No

NodeUpgradeStrategy object

Node update policy

Table 7 NodeUpgradeStrategy

Parameter

Mandatory

Type

Description

type

No

String

Policy type

rollingUpdate

No

RollingUpdateNodeUpgradeStrategy object

Rolling update

Table 8 RollingUpdateNodeUpgradeStrategy

Parameter

Mandatory

Type

Description

maxUnavailable

No

Object

Maximum number of unavailable nodes

maxSurge

No

Object

Maximum number of nodes allowed beyond the expected count

deletePolicy

No

String

Deletion policy. The options are Random, Oldest, and Newest.

Response Parameters

Status code: 200

Table 9 Parameter in the response body

Parameter

Type

Description

-

String

  

Status code: 400

Table 10 Parameter in the response body

Parameter

Type

Description

-

String

  

Status code: 403

Table 11 Parameter in the response body

Parameter

Type

Description

-

String

  

Status code: 500

Table 12 Parameter in the response body

Parameter

Type

Description

-

String

  

Example Request

Updating the country and city of a cluster

PUT https://ucs.myhuaweicloud.com/v1/clusters/{clusterid}

{
  "kind" : "Cluster",
  "apiVersion" : "v1",
  "metadata" : {
    "annotations" : {
      "kubeconfig" : "{\"kind\":\"Config\",\"apiVersion\":\"v1\",\"preferences\":{},\"clusters\":[{\"name\":\"internalCluster\",\"cluster\":{\"server\":\"https://100.94.13.93:5443\",\"insecure-skip-tls-verify\":true}}],\"users\":[{\"name\":\"user\",\"user\":{\"client-certificate-data\":\"\",\"client-key-data\":\"\"}}],\"contexts\":[{\"name\":\"internal\",\"context\":{\"cluster\":\"internalCluster\",\"user\":\"user\"}}],\"current-context\":\"internal\"}"
    }
  },
  "spec" : {
    "country" : "AL",
    "city" : "AL"
  }
}

Example Response

None

Status Codes

Status Code

Description

200

Information information updated.

400

Client request error. The server could not execute the request.

403

The server refused the request.

500

Internal server error.

Error Codes

For details, see Error Codes.