Resize cluster Kubernetes
POST
/v1/clusters/{cluster_ident}/actions/resizeThay đổi số worker node trong cluster. Control plane không bị resize bởi lệnh gọi này. Thao tác là bất đồng bộ: cluster ở trạng thái RESIZE_IN_PROGRESS cho tới khi các worker sẵn sàng.
info
Nguồn: resize-a-cluster
Request
Tham số
cluster_identstringbắt buộcpathUUID hoặc tên của cluster.
node_countintegerbắt buộcbodySố worker node mục tiêu. Mặc định: 1.
nodes_to_removearraybodyID các server cần xoá khi scale down.
Request mẫu
curl -ks -X POST -H 'Content-Type: application/json' \
-H 'OpenStack-API-Version: container-infra 1.8' -H 'X-Auth-Token: gAAAAA<...>' \
-d '{"node_count": 2}' \
https://api.vietnix.cloud:9513/v1/clusters/{cluster_ident}/actions/resize
Response
Mã trạng thái
Thành công
| Mã trạng thái | Mô tả |
|---|---|
| 202 - Accepted | Yêu cầu resize đã được nhận và đang xử lý. |
Lỗi
| Mã trạng thái | Mô tả |
|---|---|
| 401 - Unauthorized | Cần xác thực trước khi gửi request. |
| 403 - Forbidden | Policy không cho phép user hiện tại thực hiện thao tác này. |
| 404 - Not Found | Cluster không tồn tại. |
| 409 - Conflict | Cluster đang ở trạng thái không cho phép resize. |
note
Khi cluster chạy workload stateful, hãy scale down từng node một. Xoá nhiều worker cùng lúc có thể làm mất replica nhanh hơn khả năng scheduler tạo lại. Hãy drain node trước, hoặc chỉ định rõ nodes_to_remove.