Create a Cluster on Huawei Cloud Stack
ACP CLI (ac) renders the Cluster API and HCS objects from one install-config.yaml, applies them to the global cluster, and reports the creation stages. Every object lives in the cpaas-system namespace of the global cluster.
Prerequisites
Procedure
1. Write install-config.yaml
Create an installation directory for the cluster and write install-config.yaml in it. ac writes manifests/ and logs/ac.log next to it.
Copy the following template, fill in the placeholders, and delete the comment blocks you do not use; for the fields, see Parameters.
install-config.yaml
cluster:
# Required: a DNS-1123 subdomain of at most 63 characters, not global and not starting with global-.
clusterName: <cluster-name>
sshKeys: # Required: the SSH public keys installed on every node.
- <ssh-public-key>
# Use the following block only for a registry other than the platform's. It requires platform v4.4.0 or later.
# registrySecretRef:
# name: <registry-secret-name> # Required: at most 63 characters.
# namespace: cpaas-system # Default: cpaas-system, the only accepted value.
# encryptionProviderConfig: <encryption-key> # Optional: the base64 of a 16, 24, or 32 byte aescbc key. Empty generates a key.
network: # Do not add loadBalancer: the control plane endpoint is provider.hcs.elb.
podCIDR: 10.199.0.0/16 # Default: 10.199.0.0/16.
serviceCIDR: 10.96.0.0/12 # Default: 10.96.0.0/12.
kubeOVN:
joinCIDR: 100.64.0.0/16 # Default: 100.64.0.0/16. The Pod, Service, and join CIDRs must not overlap.
provider:
hcs:
imageName: <image-name> # Required: the Alauda OS image uploaded to HCS.
# Required unless every node group sets hcs.flavorName: the default flavor, by its API name. It sets CPU and memory.
flavorName: <flavor-name>
# availabilityZone: <az> # Optional: the default zone. Empty takes the first available zone that HCS reports.
network: # Required: the primary NIC location, shared by all nodes.
vpcName: <vpc-name> # Required.
securityGroupName: <security-group> # Required.
subnetName: <primary-subnet> # Required: the node subnet, an existing subnet of the VPC.
elb: # Required: the control plane ELB, which the provider creates.
vipAddress: <control-plane-vip> # Required: the control plane VIP, an IPv4 address in the VIP subnet.
# vipSubnetName: <vip-subnet-name> # Optional: empty takes network.subnetName.
l4: # Required: the L4 Hybrid Load Balancing addresses.
# subnetName: <subnet-name> # Optional: empty takes network.subnetName.
ips: [<l4-ip-1>, <l4-ip-2>] # Required: exactly two distinct IPv4 addresses.
l7: # Required: the L7 Hybrid Load Balancing addresses.
# subnetName: <subnet-name> # Optional: empty takes network.subnetName.
ips: [<l7-ip-1>, <l7-ip-2>] # Required: exactly two distinct IPv4 addresses.
rootDisk: # Required unless every node group sets hcs.rootDisk: the system disk of all nodes.
type: SSD # Default: SSD. The EVS type: SSD, SAS, or SATA.
sizeGiB: <root-disk-gib> # Required: greater than 0.
diskType: SSD # Default: SSD. The EVS type of the data and persistent disks: SSD, SAS, or SATA.
# controlPlaneHA: # Optional: omit it to spread the control plane across physical hosts with the defaults below.
# enabled: true # Default: true. false lets HCS place the control plane freely.
# policy: soft-anti-affinity # Default: soft-anti-affinity. Or anti-affinity.
controlPlane: # Required: the control plane node group. Do not add cpuCore or memoryGiB: the flavor sets them.
# Required: an odd number, 1 or 3 or more. A cluster with a single control plane node is for testing and cannot be upgraded.
replicas: 3
# Use the following block only when this node group differs from provider.hcs:
# hcs:
# flavorName: <flavor-name> # Optional: overrides provider.hcs.flavorName.
# availabilityZone: <az> # Optional: overrides provider.hcs.availabilityZone.
# subnetName: <subnet-name> # Optional: overrides provider.hcs.network.subnetName.
# rootDisk: # Optional: replaces provider.hcs.rootDisk. Set both fields.
# type: SSD
# sizeGiB: <root-disk-gib>
network: # Do not add gateway, dns, or mask: the subnet supplies them.
additions: [] # Default: []. The additional NICs, matched in order to hosts[].additionalIps.
# To add NICs, replace "additions: []" with the following block:
# additions:
# - hcs:
# subnetName: <additional-subnet> # Optional: empty takes this node group's subnet.
disks: # Required: keep the standard disk names and set sizeGiB.
ephemeral: # Required: disks recreated with the instance.
- name: var-lib-containerd
sizeGiB: 100
- name: var-lib-kubelet
sizeGiB: 100
- name: var-lib-etcd # Control plane only.
sizeGiB: 20
persistent: # Required: disks kept when the instance is replaced.
- name: var-cpaas
sizeGiB: 100
rawDisks: [] # Default: []. Raw block volumes for TopoLVM.
# To add raw disks, replace "rawDisks: []" with the following block:
# rawDisks:
# - name: data-001 # Required: a name of your choice.
# sizeGiB: 50 # Required: greater than 0.
# Use the following block only to override provider.hcs.diskType for this node group:
# hcs:
# type: SSD # Optional: overrides provider.hcs.diskType.
hosts: # Required: at least replicas entries.
- hostname: <cp-0-hostname> # Required.
ip: <cp-0-ip> # Required: the primary NIC address, IPv4.
additionalIps: [] # Default: []. One IPv4 address per network.additions entry, in order.
- hostname: <cp-1-hostname>
ip: <cp-1-ip>
additionalIps: []
- hostname: <cp-2-hostname>
ip: <cp-2-ip>
additionalIps: []
computes: # Optional: the worker node groups. Delete this section to run on the control plane nodes alone.
- name: worker # Required: a DNS-1123 label, unique per group. control-plane is reserved.
replicas: 3 # Required: the number of nodes in this group.
# Use the following block only when this node group differs from provider.hcs:
# hcs:
# flavorName: <flavor-name> # Optional: overrides provider.hcs.flavorName.
# availabilityZone: <az> # Optional: overrides provider.hcs.availabilityZone.
# subnetName: <subnet-name> # Optional: overrides provider.hcs.network.subnetName.
# rootDisk: # Optional: replaces provider.hcs.rootDisk. Set both fields.
# type: SSD
# sizeGiB: <root-disk-gib>
network: # Do not add gateway, dns, or mask: the subnet supplies them.
additions: [] # Default: []. The additional NICs, matched in order to hosts[].additionalIps.
# To add NICs, replace "additions: []" with the following block:
# additions:
# - hcs:
# subnetName: <additional-subnet> # Optional: empty takes this node group's subnet.
disks: # Required: keep the standard disk names and set sizeGiB.
ephemeral: # Required: disks recreated with the instance. Workers have no var-lib-etcd.
- name: var-lib-containerd
sizeGiB: 100
- name: var-lib-kubelet
sizeGiB: 100
persistent: # Required: disks kept when the instance is replaced.
- name: var-cpaas
sizeGiB: 100
rawDisks: [] # Default: []. Raw block volumes for TopoLVM.
# To add raw disks, replace "rawDisks: []" with the following block:
# rawDisks:
# - name: data-001 # Required: a name of your choice.
# sizeGiB: 50 # Required: greater than 0.
# Use the following block only to override provider.hcs.diskType for this node group:
# hcs:
# type: SSD # Optional: overrides provider.hcs.diskType.
hosts: # Required: at least replicas entries.
- hostname: <worker-0-hostname> # Required.
ip: <worker-0-ip> # Required: the primary NIC address, IPv4.
additionalIps: [] # Default: []. One IPv4 address per network.additions entry, in order.
- hostname: <worker-1-hostname>
ip: <worker-1-ip>
additionalIps: []
- hostname: <worker-2-hostname>
ip: <worker-2-ip>
additionalIps: []
credentialRef: # Required: the HCS credential Secret.
name: <credential-secret-name> # Required: the Secret name.
namespace: cpaas-system # Default: cpaas-system, the only accepted value.
The credential Secret must exist before you run create. For cluster.registrySecretRef, see Workload Cluster Image Registry.
2. Create the Cluster
Run the following command from a machine where ac is logged in to the platform:
ac config use-cluster global
ac adm alpha cluster create --dir <install-dir> --provider hcs
ac first checks the platform's Kubernetes and Kube-OVN versions, the providers, the registry, and the credential Secret and its IAM endpoint. If a check fails, nothing is changed and the error names the item. Make sure the credential and the image, flavor, availability zone, VPC, subnet, and security group names are correct before you run create.
create returns once the objects are applied, and the cluster keeps building. Add --wait to wait until all stages are ready; --timeout (default 2h) limits only the wait. To render without applying, run ac adm alpha cluster manifests with the same --dir and --provider.
3. Monitor the Creation
ac config use-cluster global
ac adm alpha cluster status --cluster <cluster-name> # prints the four stages once
ac adm alpha cluster wait-for install-complete --cluster <cluster-name> # waits until all four are ready
Continue when all four stages are ready; otherwise see Troubleshooting.
4. Verify the Cluster
Run the following commands from a machine where ac is logged in to the platform:
ac config sync
ac config use-cluster <cluster-name>
ac get nodes
ac config use-cluster global
Continue when every node is Ready; otherwise see Troubleshooting.
Control Plane HA
Applies to: provider.hcs.controlPlaneHA.enabled: true, the default. Skip it when it is false.
ac config use-cluster global
ac -n cpaas-system get hcscluster <cluster-name> \
-o jsonpath='{range .status.conditions[?(@.type=="ControlPlaneHAReady")]}{.status}{" "}{.reason}{" "}{.message}{"\n"}{end}'
Continue when the status is True; otherwise see Control Plane HA in Troubleshooting.
Run create Again
create only creates the cluster. Do not run it on a cluster that is already created; to change a running cluster, see Manage Nodes.
If create stops before the cluster is created, run the same command again; completed work is skipped. Running create again on the same directory recreates objects that were deleted, except that ac creates Secrets once and then leaves them as they are. It does not overwrite a field changed with another tool: when the rendered value differs, create reports that the fields are owned by another manager and stops. Do not delete the object that the error names. When manifests/ already exists, create asks whether to reuse it: press Enter to reuse it, or answer n to render again after you change install-config.yaml. When standard input is not a terminal, pass --reuse-manifests=true or --reuse-manifests=false. Reusing manifests/ ignores install-config.yaml and skips every check.
Do not edit the files in manifests/.
WARNING
Keep <install-dir>/manifests/, or set cluster.encryptionProviderConfig: on disk, a generated encryption key is kept only in manifests/. Rendering again without either generates a new key, and manifests/ then no longer records the key the cluster uses.
Next Steps