Installing Huawei KooCli in Linux system

find out if the existing system is x86 or arm architecture
>> echo $HOSTTYPE

Download the relevant Huawei KooCli

x86_64
>> curl -LO "https://ap-southeast-3-hwcloudcli.obs.ap-southeast-3.myhuaweicloud.com/cli/latest/huaweicloud-cli-linux-amd64.tar.gz"

Or
arm64
>> curl -LO "https://ap-southeast-3-hwcloudcli.obs.ap-southeast-3.myhuaweicloud.com/cli/latest/huaweicloud-cli-linux-arm64.tar.gz"

unzip the Huawei KooCli installation file
>> tar -zxvf huaweicloud-cli-linux-amd64.tar.gz

Move the folder to /usr/local/bin, please ensure /usr/local/bin exists in the value of the system variable PATH.
>> mv $(pwd)/hcloud /usr/local/bin/

Run the Huawei KooCli
>> hcloud version

To see a full list of relevant commands
>> hcloud

To interact with Huawei Cloud Services, we need to first configure the initial ak/sk, cli-region etc
>> hcloud configure init

Now we can use KooCli to create Huawei Cloud ECS servers or create a cluster via command line:

  1. check what ECS servers are available with a certain tag name

>> hcloud ECS ListServersDetails –tags=<Your ECS Server Tag Name>

Below we can install the same in our local laptop to do the same.
Use Huawei Cloud kooCli to create ECS servers:

    1. base on your huawei cloud region, ECS instance flavor, image types (here I choose ubuntu 22.04 server image), server name, vpc, security group etc to create 1 ansible control plane and 2 worker nodes for learning purpose

Tis: Use Huawei Cloud API Explorer (https://console.huaweicloud.com/apiexplorer/#/openapi/ECS/doc?api=NovaListVersions ) to generate the hcloud command as below:
> hcloud ECS CreateServers –cli-region="ap-southeast-3" –server.security_groups.1.id="94e3e7XXXXXXXXXXX15e75" –server.vpcid="9341XXXXXXXXXXXXXXXXXxcc0" –server.data_volumes.1.volumetype="SSD" –server.data_volumes.1.size=100 –server.name="xxxx-TerraformAnsiblePuppetClient2" –server.nics.1.subnet_id="229524d7-XXXXXXXXXXXXXXe962" –server.root_volume.volumetype="SSD" –server.root_volume.size=100 –server.flavorRef="c7n.xlarge.4" –server.extendparam.chargingMode="postPaid" –server.publicip.eip.bandwidth.size=10 –server.publicip.eip.bandwidth.chargemode="traffic" –server.publicip.eip.bandwidth.sharetype="PER" –server.publicip.eip.extendparam.chargingMode="postPaid" –server.publicip.eip.iptype="5_bgp" –server.imageRef="1c136XXXXXXXXXXXXXXXXXXXXdc58" –server.adminPass="YourPassword" –server.server_tags.1.value="XXXXXX" –server.server_tags.1.key="XXXXXXX"

b. Check if all servers are ready with below command
> hcloud ECS ListServersDetails –tags=XXXXXX

Alternatively you may use the Select-String -Pattern "x" in powershell to "grep" the relevant string from above:
win:
> hcloud ECS ListServersDetails –tags=Demo-PoC | Select-String -Pattern "addr"

linux:
>> hcloud ECS NovaListServers –tags=Demo-PoC | grep "addr"

9

Note: mark down the internal and/or external ip address of 3 servers.

Choose the server with external ip as master, use ssh tool (e.g. mobaXterm) to login to the server
10use hcloud to turn on/off Huawei Cloud ECS server:

check the status of the servers:
linux:
>> hcloud ECS ListServersDetails –tags=Demo-PoC | grep -e name -e vm_state

Under the tag name, we found 2 servers, 1 active and 1 stop, in this case.
Lets start the stopped server:
>> hcloud ECS NovaStartServer –cli-region="ap-southeast-3" –server_id="f84ab231-a4bc-4127-b9af-43d336588bfa" –os-start=

so now we can see both ECS server are in "Active" status

Evernote helps you remember everything and get organized effortlessly. Download Evernote.

ad00a913-786a-4f47-adb9-29a9f5c96595

Related Posts