华为云koocli
华为云KooCLI是一个云管理命令行工具,它提供了一种简单、一致的方式来管理华为云资源。通过KooCLI,用户可以使用统一的命令和操作来管理应用和配置,从而提高云环境的运维效率。
自动应答安装
Section titled “自动应答安装”安装
curl -sSL https://ap-southeast-3-hwcloudcli.obs.ap-southeast-3.myhuaweicloud.com/cli/latest/hcloud_install.sh -o ./hcloud_install.sh && bash ./hcloud_install.sh -y初始化并运行
[root@testcce-26771 ~]# hcloud configure initThis will delete all configuration information. Continue? (y/N): yStarting initialization. 'Secret Access Key' is anonymized. To obtain the parameter, see 'https://support.huaweicloud.com/intl/en-us/usermanual-hcli/hcli_09.html'.Access Key ID [required]: SNVJ1HU1TQ0DB3RG1PHJSecret Access Key [required]: ****Secret Access Key (again): ****Region: la-north-2
************************************************************* ********** Initialization successful ********** *************************************************************
[root@testcce-26771 ~]# hcloud ECS NovaListServers{ "servers": [ { "name": "testcce-26771", "links": [ { "rel": "self", "href": "https://ecs.la-north-2.myhuaweicloud.com/v2.1/0e0e5cabfa80f2892f17c00390299e63/servers/8d0c9e65-1fc8-45ea-bdc7-9c42467f760b" }, { "rel": "bookmark", "href": "https://ecs.la-north-2.myhuaweicloud.com/0e0e5cabfa80f2892f17c00390299e63/servers/8d0c9e65-1fc8-45ea-bdc7-9c42467f760b" } ], "id": "8d0c9e65-1fc8-45ea-bdc7-9c42467f760b" } ]}自定义 Koocli 输出格式 ,可以输出为表格格式,同进也可以通过json过滤输出某些想要的内容。
通过docker方式安装运行
Section titled “通过docker方式安装运行”编写dockerfile
FROM ubuntu:latestRUN apt-get update -y && apt-get install curl -y# Install KooCLI with one click.RUN curl -sSL https://ap-southeast-3-hwcloudcli.obs.ap-southeast-3.myhuaweicloud.com/cli/latest/hcloud_install.sh -o ./hcloud_install.sh && bash ./hcloud_install.sh -yWORKDIR hcloudENTRYPOINT ["/usr/local/bin/hcloud"]build镜像并运行
docker build --no-cache -t hcloudcli .docker run -it -d --name hcloudcli hcloudclidocker run --rm -it hcloudcli ${command}docker run --rm -it -v /root/.hcloud/:/root/.hcloud/ hcloudcli ${command}alias hcloud='docker run --rm -it hcloudcli'