关于 Civo CLI
Civo CLI 提供对 Civo 云基础设施的命令行控制。它支持直接从终端配置 Kubernetes 集群、计算实例、网络、存储卷和市场应用程序。
主要功能
- 01使用自定义配置创建和删除 Kubernetes 集群
- 02管理计算实例、网络和防火墙
- 03在集群中安装市场应用程序
- 04获取集群凭证并配置本地访问
适用场景
- 01在开发工作流中自动化 Kubernetes 集群配置
- 02从脚本管理多个 Civo 基础设施资源
- 03将 Civo 集群创建集成到部署流程中
安装
选择你的系统或包管理器,复制命令到终端运行。
安装完成后运行civo --version确认安装成功。
命令示例
常用命令按使用顺序排列。
详细介绍
Civo 命令行客户端
简介
Civo CLI 是一款工具,可让你在终端中管理自己的 Civo.com 账户。Civo Web 控制面板提供了一个易于使用的界面来管理账户;但如果你想自动化管理账户、运行脚本,或管理多个复杂服务,这里介绍的命令行界面会很有用。本指南将通过示例介绍 Civo CLI 工具的设置和使用方法。
**状态:**此项目目前正在积极开发和维护。
目录
- 简介
- 全局选项
- 设置
- CLI 版本/更新
- Docker 用法
- API 密钥
- 实例
- Kubernetes 集群
- Kubernetes 应用
- 域名和域名记录
- 防火墙
- 网络
- 数据库备份与恢复
- 对象存储
- 对象存储凭证
- 负载均衡器
- 配额
- 规格
- SSH 密钥
- 磁盘映像
- 卷
- 资源快照
- 团队
- 权限
- 区域
- 启用 Shell 自动补全
- 参与贡献
- 许可证
设置
Civo CLI 使用 Go 构建,以二进制文件形式分发,支持多种操作系统,可从 https://github.com/civo/cli/releases 下载。
在 macOS 上安装
如果你使用 Mac,可以通过 Homebrew 安装:
brew tap civo/tools
brew install civo
也可以根据需要在控制台中运行:
curl -sL https://civo.com/get | sh
在 Windows 上安装
Civo CLI 可通过 Chocolatey 和 Scoop 下载并安装到 Windows 上。
要通过 Chocolatey 安装,需要先在电脑上安装 Chocolatey 包管理器。
- 确认电脑上已安装 Chocolatey 后,运行以下命令:
choco install civo-cli
这样便会在电脑上安装 Civo CLI。
要通过 Scoop 安装,需要先将 Scoop 安装为包管理器,然后:
- 使用以下命令添加 extras bucket:
scoop bucket add extras
- 使用以下命令安装 civo:
scoop install civo
当然,你还需要一个 Civo 账户,可在此处注册。
在 Linux 上安装
在 Linux 上,可以通过多种方式安装 Civo CLI。
- 通过直接运行 Shell 脚本安装:
curl -sL https://civo.com/get | sh
-
通过 brew 包管理器安装,操作方法如上文的 MacOS 安装说明所示。
-
通过 wget 安装,并指定所需的发行版本。
请注意,以下示例中的版本可能不是最新版本。如果使用此方法,请根据最新的可用版本指定版本号。
wget https://github.com/civo/cli/releases/download/v1.0.40/civo-1.0.40-linux-amd64.tar.gz
tar -xvf civo-1.0.40-linux-amd64.tar.gz
chmod +x civo
mv ./civo /usr/local/bin/
- 你也可以构建二进制文件,但请确保已安装 go:
git clone https://github.com/civo/cli.git
cd cli
make
cd ..
cp -r cli $HOME
export PATH="$HOME/cli:$PATH"
至此,我们已成功安装 Civo CLI。运行以下任意命令,检查是否正常工作。
**注意:**首次运行时,请确保设置当前区域。更多信息请参阅区域。
运行 Civo CLI 工具并获取帮助
要使用此工具,只需使用所选选项运行 civo。输入 help 或 -h 命令,即可获取命令及其选项的上下文相关帮助:
civo help、
civo instance help、
civo instance create help
等。Civo CLI 的主要组成部分将在以下章节中介绍。
CLI 版本/更新
每位用户每隔 24 小时会收到一次更新 CLI 的提醒;如果发生任何错误,也会收到更新 CLI 版本的通知。运行 civo update,即可将 CLI 更新到最新版本。
Docker 用法
如果你希望保持基础操作系统干净,也可以在 Docker 容器中运行 Civo 的 CLI 工具。
通常,你需要映射 API 密钥以便持久保存。
touch $HOME/.civo.json
docker run -it --rm -v $HOME/.civo.json:/.civo.json civo/cli:latest
你也可以使用 CLI 的 Kubernetes 选项。我们的镜像中包含 Kubectl;要使用它,只需将配置挂载到容器中。
touch $HOME/.civo.json
mkdir $HOME/.kube/
touch $HOME/.kube/config
docker run -it --rm -v $HOME/.civo.json:/.civo.json -v $HOME/.kube/config:/root/.kube/config civo/cli:latest
为了更方便地使用,建议设置别名。以下示例展示了如何将别名设置为与直接在系统上安装后使用的命令相同,并使用 Docker 镜像:
Ubuntu 等:
alias civo="docker run -it --rm -v $HOME/.civo.json:/.civo.json civo/cli:latest"
# Maybe put the above line in ~/.bash_profile or ~/.zshrc
civo sshkey list
civo instance list
civo instance create --size g2.xsmall
civo k8s list
Fedora 用户:
alias civo="docker run -it --rm -v $HOME/.civo.json:/.civo.json:Z -v $HOME/.kube/config:$HOME/.kube/config:Z civo/cli:latest"
以下示例展示了如何设置别名并开始使用 Kubernetes。
alias civo="docker run -it --rm -v $HOME/.civo.json:/.civo.json -v $HOME/.kube/config:$HOME/.kube/config civo/cli:latest"
# Maybe put the above line in ~/.bash_profile or ~/.zshrc
civo sshkey list
civo instance list
civo instance create --size g2.xsmall
civo k8s list
全局选项
civo CLI 有多个全局选项,可以像这样使用:
--config string config file (default is $HOME/.civo.json)
-f, --fields string output fields for custom format output (use -h to determine fields)
-h, --help help for civo
-o, --output string output format (json/human/custom) (default "human")
--pretty Print pretty the json output
--region string Choose the region to connect to, if you use this option it will use it over the default region
-y, --yes Automatic yes to prompts; assume "yes" as answer to all prompts and run non-interactive
API 密钥
简介
要使用命令行工具,你需要使用专用密钥向 Civo API 进行身份验证。你可以在 https://www.civo.com/api 查找自动生成的 API 密钥,或重新生成密钥。CLI 有一个名为 CIVO_TOKEN 的全局环境变量;如果设置了该变量,CLI 将使用此令牌,而不是配置文件中的令牌。这适用于脚本场景或 CI/CD 流水线。设置 CIVO_TOKEN 后,你会在 civo apikey list 命令中看到一个名为 tempKey 的新 apikey 条目。
向账户添加当前 API 密钥
你可以通过 API Keys 命令将 API 密钥添加到 CLI 工具中。
civo apikey add apikey_name apikey,例如:
$ civo apikey add Demo_Test_Key DAb75oyqVeaE7BI6Aa74FaRSP0E2tMZXkDWLC9wNQdcpGfH51r
Saved the API Key Demo_Test_Key as DAb75oyqVeaE7BI6Aa74FaRSP0E2tMZXkDWLC9wNQdcpGfH51r
由于你可以存储多个 API 密钥来管理多个账户,因此需要使用 civo apikey current [apikey_name] 指定工具用于身份验证的密钥。此命令会将你选择的 API 密钥设为默认密钥,供之后的所有命令使用:
$ civo apikey current Demo_Test_Key
Set the default API Key to be Demo_Test_Key
默认情况下,Civo 账户凭据 API 密钥以及区域等其他设置会保存在用户主目录下名为 .civo.json 的文件中。可以使用环境变量 CIVO_CONFIG 更改该文件的默认位置。
管理和列出 API 密钥
你可以通过运行 civo apikey list 列出配置中存储的所有 API 密钥,也可以使用 civo apikey remove apikey_name 按名称移除密钥。
要查看密钥,可以使用 civo apikey show,该命令只会显示默认密钥;要查看其他密钥,只需使用 civo apikey show NAME
civo apikey list
+--------------+---------+
| Name | Default |
+--------------+---------+
| my_username | <===== |
+--------------+---------+
civo apikey show my_username
+-------------+------------+
| Name | Key |
+-------------+------------+
| my_username | secret_key |
+-------------+------------+
实例
简介
实例是在 Civo 云平台上运行的虚拟服务。实例大小可变,你可以根据账户配额运行任意数量的实例。
创建实例
你可以运行 civo instance create 并提供主机名参数以及任何选项来创建实例:
Options:
-t, --diskimage string the instance's disk image name (from 'civo diskimage ls' command)
-l, --firewall string the instance's firewall you can use the Name or the ID
-h, --help help for create
-s, --hostname string the instance's hostname
-u, --initialuser string the instance's initial user
-r, --network string the instance's network you can use the Name or the ID
-p, --publicip string This should be either "none" or "create" (default "create")
-i, --size string the instance's size (from 'civo instance size' command)
-k, --sshkey string the instance's ssh key you can use the Name or the ID
-g, --tags string the instance's tags
-w, --wait wait until the instance's is ready
--allowed-ips <ip1,ip2,...> Specifies a comma-separated list of IP addresses that the instance is allowed to use (for IP/MAC spoofing protection, the allowed_ips need to be within the network subnet that the instance is attached to).
--network-bandwidth-limit <limit_mbps> Sets the network bandwidth limit for the instance in Mbps. Use 0 for unlimited.
用法示例:
$ civo instance create --hostname=api-demo.test --size g4s.small --diskimage=ubuntu-noble --initialuser=demo-user --allowed-ips 192.168.1.100,192.168.1.101 --network-bandwidth-limit 100
The instance api-demo.test has been created
$ civo instance show api-demo.test
ID : 112f2407-fb89-443e-bd0e-5ddabc4682c6
Hostname : api-demo.test
Status : ACTIVE
Size : g4s.small
Cpu Cores : 1
Ram : 2048
SSD disk : 25
Region : LON1
Network ID : 28244c7d-b1b9-48cf-9727-aebb3493aaac
Disk image ID : ubuntu-noble
Snapshot ID :
Initial User : demo-user
Initial Password : demo-user
SSH Key :
Firewall ID : c9e14ae8-b8eb-4bae-a687-9da4637233da
Tags :
Created At : Mon, 01 Jan 0001 00:00:00 UTC # Note: This is a placeholder date
Private IP : 192.168.1.7
Public IP : 74.220.21.246
Allowed IPs : 192.168.1.100, 192.168.1.101
Network Bandwidth Limit : 100 Mbps
----------------------------- NOTES -----------------------------
如上所示,运行 civo instance show api-demo.test 即可查看实例详情。
显示实例详情
civo instance show 命令会显示特定实例的详细信息。
用法:
civo instance show <INSTANCE_ID_OR_HOSTNAME>
如果要使用自定义格式,可用字段如下:
* id
* hostname
* status
* size
* cpu_cores
* ram_mb
* disk_gb
* region
* network_id
* diskimage_id
* initial_user
* initial_password
* ssh_key
* firewall_id
* tags
* created_at
* private_ip
* public_ip
* notes
* script
* reverse_dns
* allowed_ips
* network_bandwidth_limit
现在,civo instance show 的输出包含:
- 允许的 IP:以逗号分隔的 IP 地址列表,列出允许实例使用的 IP。如果分配的私有 IP 地址不在此列表中,其流量仍会自动获得允许。
- 网络带宽限制:已配置的网络带宽限制(例如,“500 Mbps”或“无限制”)。
磁盘映像和实例规格
运行 civo diskimage ls 即可查看磁盘映像
$ civo diskimage ls
+--------------------------------------+----------------------+----------------+-----------+--------------+
| ID | Name | Version | State | Distribution |
+--------------------------------------+----------------------+----------------+-----------+--------------+
| a4204155-a876-43fa-b4d6-ea2af8774560 | debian-10 | 10 | available | debian |
+--------------------------------------+----------------------+----------------+-----------+--------------+
| 25fbbd96-d5ec-4d08-9c75-a5e154dabf9b | debian-11 | 11 | available | debian |
+--------------------------------------+----------------------+----------------+-----------+--------------+
| 887f05e7-e3b0-49b5-9ab9-6f35848e1e56 | debian-12 | 12 | available | debian |
+--------------------------------------+----------------------+----------------+-----------+--------------+
| 9b661c46-ac4f-46e1-9f3d-aaacde9b4fec | debian-9 | 9 | available | debian |
+--------------------------------------+----------------------+----------------+-----------+--------------+
| d0e47b5e-b9af-4386-9902-2ded1018dd29 | rocky-10 | 10 | available | rocky |
+--------------------------------------+----------------------+----------------+-----------+--------------+
| d052a966-385d-4018-931e-3637fe97cd13 | rocky-9 | 9 | available | rocky |
+--------------------------------------+----------------------+----------------+-----------+--------------+
| 170db96f-8458-44aa-83ca-0c31fb81a835 | rocky-9-1 | 9.1 | available | rocky |
+--------------------------------------+----------------------+----------------+-----------+--------------+
| 21613daa-a66b-44fc-87f5-b6db566d8f91 | ubuntu-cuda11-8 | 22.04-cuda11-8 | available | ubuntu |
+--------------------------------------+----------------------+----------------+-----------+--------------+
| 13232803-0928-4634-9ab8-476bff29ef1b | ubuntu-cuda12-2 | 22.04-cuda12-2 | available | ubuntu |
+--------------------------------------+----------------------+----------------+-----------+--------------+
| ece39039-56ac-4bf6-8b39-78bd895d8385 | ubuntu-cuda12-6 | 24.04-cuda12-6 | available | ubuntu |
+--------------------------------------+----------------------+----------------+-----------+--------------+
| 8d7e4997-f97d-43c8-9936-8329bbbcc6cf | ubuntu-cuda12-8 | 24.04-cuda12-8 | available | ubuntu |
+--------------------------------------+----------------------+----------------+-----------+--------------+
| 0b346fc3-2d7e-4be7-8881-34787417f7ff | ubuntu-cuda12-9 | 24.04-cuda12-9 | available | ubuntu |
+--------------------------------------+----------------------+----------------+-----------+--------------+
| d927ad2f-5073-4ed6-b2eb-b8e61aef29a8 | ubuntu-focal | 20.04 | available | ubuntu |
+--------------------------------------+----------------------+----------------+-----------+--------------+
| eda67ea0-4282-4945-9b7b-d3e1cba1d987 | ubuntu-jammy | 22.04 | available | ubuntu |
+--------------------------------------+----------------------+----------------+-----------+--------------+
| d2c2c728-512d-4087-906a-8486fcf4a1c7 | ubuntu-noble | 24.04 | available | ubuntu |
+--------------------------------------+----------------------+----------------+-----------+--------------+
运行 civo size ls 即可查看实例规格列表
$ civo size ls
+--------------------+--------------------------------+------------+-----+---------+-----+
| Name | Description | Type | CPU | RAM | SSD |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g3.xsmall | Extra Small | Instance | 1 | 1024 | 25 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g3.small | Small | Instance | 1 | 2048 | 25 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g3.medium | Medium | Instance | 2 | 4096 | 50 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g3.large | Large | Instance | 4 | 8192 | 100 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g3.xlarge | Extra Large | Instance | 6 | 16384 | 150 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g3.2xlarge | 2X Large | Instance | 8 | 32768 | 200 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4s.kube.xsmall | Extra Small - Standard | Kubernetes | 1 | 1024 | 30 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4s.kube.small | Small - Standard | Kubernetes | 1 | 2048 | 40 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4s.kube.medium | Medium - Standard | Kubernetes | 2 | 4096 | 50 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4s.kube.large | Large - Standard | Kubernetes | 4 | 8192 | 60 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4p.kube.small | Small - Performance | Kubernetes | 4 | 16384 | 60 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4p.kube.medium | Medium - Performance | Kubernetes | 8 | 32768 | 80 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4p.kube.large | Large - Performance | Kubernetes | 16 | 65536 | 120 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4p.kube.xlarge | Extra Large - Performance | Kubernetes | 32 | 131072 | 180 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4c.kube.small | Small - CPU optimized | Kubernetes | 8 | 16384 | 60 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4c.kube.medium | Medium - CPU optimized | Kubernetes | 16 | 32768 | 80 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4c.kube.large | Large - CPU optimized | Kubernetes | 32 | 65536 | 120 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4c.kube.xlarge | Extra Large - CPU optimized | Kubernetes | 64 | 131072 | 180 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4m.kube.small | Small - RAM optimized | Kubernetes | 2 | 16384 | 60 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4m.kube.medium | Medium - RAM optimized | Kubernetes | 4 | 32768 | 80 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4m.kube.large | Large - RAM optimized | Kubernetes | 8 | 65536 | 120 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4m.kube.xlarge | Extra Large - RAM optimized | Kubernetes | 16 | 131072 | 180 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g3.db.xsmall | Extra Small | Database | 1 | 2048 | 20 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g3.db.small | Small | Database | 2 | 4096 | 40 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g3.db.medium | Medium | Database | 4 | 8192 | 80 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g3.db.large | Large | Database | 6 | 16384 | 160 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g3.db.xlarge | Extra Large | Database | 8 | 32768 | 320 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g3.db.2xlarge | Double Extra Large | Database | 10 | 65536 | 640 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g3.kf.small | Small - CPU optimized | KfCluster | 4 | 16384 | 60 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g3.kf.medium | Medium - CPU optimized | KfCluster | 8 | 32768 | 80 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g3.kf.large | Large - CPU optimized | KfCluster | 16 | 65536 | 120 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g3.kf.xlarge | Extra Large - CPU optimized | KfCluster | 32 | 131072 | 180 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4s.xsmall | xSmall - Standard | Instance | 1 | 1024 | 25 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4s.small | Small - Standard | Instance | 1 | 2048 | 25 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4s.medium | Medium - Standard | Instance | 2 | 4096 | 50 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4s.large | Large - Standard | Instance | 4 | 8192 | 100 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4s.xlarge | Extra Large - Standard | Instance | 6 | 16384 | 150 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4s.2xlarge | 2X Large - Standard | Instance | 8 | 32768 | 200 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.kube.small | Small - Nvidia A100 80GB | Kubernetes | 12 | 131072 | 100 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.kube.medium | Medium - Nvidia A100 80GB | Kubernetes | 24 | 262144 | 100 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.kube.large | Large - Nvidia A100 80GB | Kubernetes | 48 | 524288 | 100 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.kube.xlarge | Extra Large - Nvidia A100 80GB | Kubernetes | 96 | 1048576 | 100 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.small | Small - Nvidia A100 80GB | Instance | 12 | 131072 | 200 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.medium | Medium - Nvidia A100 80GB | Instance | 24 | 262144 | 200 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.large | Large - Nvidia A100 80GB | Instance | 48 | 524288 | 400 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.xlarge | Extra Large - Nvidia A100 80GB | Instance | 96 | 1048576 | 400 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.40.small | Small - Nvidia A100 40GB | Instance | 8 | 65536 | 200 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.40.medium | Medium - Nvidia A100 40GB | Instance | 16 | 131072 | 400 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.40.large | Large - Nvidia A100 40GB | Instance | 32 | 262133 | 400 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.40.xlarge | Extra Large - Nvidia A100 40GB | Instance | 64 | 524288 | 400 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.40.kube.small | Small - Nvidia A100 40GB | Kubernetes | 8 | 65536 | 200 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.40.kube.medium | Medium - Nvidia A100 40GB | Kubernetes | 16 | 131072 | 400 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.40.kube.large | Large - Nvidia A100 40GB | Kubernetes | 32 | 262133 | 400 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.40.kube.xlarge | Extra Large - Nvidia A100 40GB | Kubernetes | 64 | 524288 | 400 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| an.g1.l40s.x1 | Small - Nvidia L40S 40GB | Instance | 12 | 131072 | 200 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| an.g1.l40s.x2 | Medium - Nvidia L40S 40GB | Instance | 24 | 262133 | 200 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| an.g1.l40s.x4 | Large - Nvidia L40S 40GB | Instance | 48 | 524288 | 400 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| an.g1.l40s.x8 | Extra Large - Nvidia L40S 40GB | Instance | 96 | 1048576 | 400 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| an.g1.l40s.kube.x1 | Small - Nvidia L40S 40GB | Kubernetes | 12 | 131072 | 200 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| an.g1.l40s.kube.x2 | Medium - Nvidia L40S 40GB | Kubernetes | 24 | 262133 | 200 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| an.g1.l40s.kube.x4 | Large - Nvidia L40S 40GB | Kubernetes | 48 | 524288 | 400 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| an.g1.l40s.kube.x8 | Extra Large - Nvidia L40S 40GB | Kubernetes | 96 | 1048576 | 400 |
+--------------------+--------------------------------+------------+-----+---------+-----+
实例快照
快照可用于创建实例在某个时间点的副本。你可以使用这些快照创建新实例,或将现有实例恢复到之前的状态。
创建快照
创建实例快照:
$ civo instance snapshot create INSTANCE_NAME [flags]
Flags:
-n, --name string The name of the snapshot (default: auto-generated)
-d, --description string Description for the snapshot
列出快照
查看特定实例的所有可用快照:
$ civo instance snapshot list INSTANCE_NAME/ID
从快照恢复
从快照恢复实例:
$ civo instance snapshot restore INSTANCE_NAME/ID SNAPSHOT_NAME/ID [flags]
Flags:
-d, --description string New description for the restored instance
--hostname string New hostname for the restored instance (optional)
--private-ipv4 string New private IPv4 address for the restored instance (optional)
--overwrite-existing Overwrite an existing instance if it shares the same IP or hostname (defaults to false)
示例:
$ civo instance snapshot restore my-instance-id snap-123 --hostname restored-instance-new-name --overwrite-existing
更新快照
更新实例快照的名称或描述:
$ civo instance snapshot update INSTANCE_NAME/ID SNAPSHOT_NAME/ID [flags]
Flags:
-n, --name string New name for the snapshot
-d, --description string New description for the snapshot
示例:
$ civo instance snapshot update my-instance my-snapshot --name new-snapshot-name --description "Updated snapshot description"
移除快照
删除快照:
$ civo instance snapshot remove INSTANCE_NAME/ID SNAPSHOT_NAME/ID
查看实例的默认用户密码
运行 civo instance password ID/hostname 即可查看实例的默认用户密码
$ civo instance password api-demo.test
The instance api-demo.test (112f2407-fb89-443e-bd0e-5ddabc4682c6) has the password BrbXNW2RUYLe (and user demo-user)
你也可以在此命令中使用选项 -o 和 -f,仅输出密码,适用于脚本场景:
$ civo instance password api-demo.test -o custom -f Password
BrbXNW2RUYLe
查看实例的公共 IP 地址
如果实例配置了公共 IP 地址,可以使用 civo instance public-ip ID/hostname 显示该地址:
$ civo instance public-ip api-demo.test -o custom -f public_ip # Corrected from 'show' to 'public-ip'
74.220.21.246
上述示例使用 -o 和 -f,仅在输出中显示 IP 地址。
设置防火墙
实例可以使用单独配置的防火墙。默认情况下,创建实例时会设置允许所有端口开放的默认防火墙规则。如果你想提高实例的安全性,则需要配置一些规则(详情请参阅防火墙)。配置好规则后,可以运行 civo firewall ls 检查:
$ civo firewall ls
+--------------------------------------+------------------------------------+---------+-------------+-----------------+
| ID | Name | Network | Total rules | Total Instances |
+--------------------------------------+------------------------------------+---------+-------------+-----------------+
| c9e14ae8-b8eb-4bae-a687-9da4637233da | Default (all open) | Default | 3 | 0 |
| f79db64d-41f0-4be0-ae80-ce4499164319 | Kubernetes cluster: Demo | Default | 2 | 0 |
+--------------------------------------+------------------------------------+---------+-------------+-----------------+
你可以获取防火墙 ID,并使用命令 civo instance firewall ID/hostname firewall_id 将防火墙关联到实例。例如:
$ civo instance firewall api-demo.test f79db64d-41f0-4be0-ae80-ce4499164319
Set the firewall for the instance api-demo.test (112f2407-fb89-443e-bd0e-5ddabc4682c6) to Kubernetes cluster: Demo (f79db64d-41f0-4be0-ae80-ce4499164319)
更新实例的允许 IP
新增用于管理实例允许 IP 地址的命令(IP/MAC 欺骗防护)。此命令会替换现有的允许 IP 列表。
用法:
civo instance allowed-ips-update <INSTANCE_ID_OR_NAME> --ips <ip1,ip2,...>
参数和标志:
<INSTANCE_ID_OR_NAME>(必需):实例的 ID 或主机名。--ips <ip1,ip2,...>:要设置的 IP 地址列表,以逗号分隔。若要清除所有允许的 IP,请提供空字符串(例如,--ips "")。
示例:
设置允许的 IP:
civo instance allowed-ips-update my-instance-01 --ips 192.168.0.10,192.168.0.11
清除所有允许的 IP:
civo instance allowed-ips-update my-instance-01 --ips ""
更新实例的网络带宽限制
新增用于更新现有实例网络带宽限制的命令。
用法:
civo instance bandwidth-update <INSTANCE_ID_OR_NAME> --limit <BANDWIDTH_MBPS>
参数和标志:
<INSTANCE_ID_OR_NAME>(必需):实例的 ID 或主机名。--limit <BANDWIDTH_MBPS>(必需):所需的网络带宽限制,单位为 Mbps。使用0表示不限制。
示例:
设置 500 Mbps 的限制:
civo instance bandwidth-update my-instance-01 --limit 500
设置为不限制(假设 API 将 0 视为不限制):
civo instance bandwidth-update my-instance-01 --limit 0
列出实例
运行 civo instance list 即可列出与特定 API 密钥关联的所有实例。
列出实例规格
运行 civo instance size 即可列出所有实例规格。
重启实例
用户可以随时重启实例,例如修复崩溃的软件。只需运行 civo instance reboot instanceID/hostname。你会看到确认消息:
$ civo instance reboot api-demo.test
Rebooting api-demo.test. Use 'civo instance show api-demo.test' to see the current status.
如果你希望执行硬重启,可以改为运行 civo instance hard-reboot instanceID/hostname。
移除实例
你可以使用命令从账户中移除实例。此操作会立即生效,请谨慎操作!实例的任何快照以及任何已映射的存储都会保留。
用法:civo instance remove instanceID/hostname。例如:
$ civo instance remove api-demo.test
The instance (api-demo.test) has been deleted
停止(关闭)和启动实例
随时可以运行 civo instance stop instanceID/hostname 来关闭实例:
$ civo instance stop api-demo.test
Stopping api-demo.test. Use 'civo instance show api-demo.test' to see the current status.
可以使用 civo instance start instanceID/hostname 重新启动账户中的任何已关闭实例:
$ civo instance start api-demo.test
Starting api-demo.test. Use 'civo instance show api-demo.test' to see the current status.
(重新)标记实例
标签有助于区分和管理实例。可以按如下方式使用 civo instance tags instanceID/hostname 'tag1 tag2 tag3...' 为实例重新添加标签:
$ civo instance tags api-demo.test 'ubuntu demo'
The instance api-demo.test (b5f82fa7-b8e4-44aa-9dda-df02dab71d6c) has been tagged with ubuntu demo. Use 'civo instance show api-demo.test' to see the current tags.'
$ civo instance show api-demo.test
ID : b5f82fa7-b8e4-44aa-9dda-df02dab71d6c
Hostname : api-demo.test
Status : SHUTOFF
Size : g3.small
Cpu Cores : 1
Ram : 2048
SSD disk : 25
Region : LON1
Network ID : 28244c7d-b1b9-48cf-9727-aebb3493aaac
Disk image ID : ubuntu-bionic
Snapshot ID :
Initial User : demo-user
Initial Password : demo-user
SSH Key :
Firewall ID : c9e14ae8-b8eb-4bae-a687-9da4637233da
Tags : ubuntu demo
Created At : Mon, 01 Jan 0001 00:00:00 UTC
Private IP : 192.168.1.7
Public IP : 74.220.16.23
----------------------------- NOTES -----------------------------
更新实例信息
如果需要重命名实例或添加备注,可以使用 instance update 命令,具体如下:
$ civo instance update api-demo.test --hostname api-demo-renamed.test --notes 'Hello, world!'
The instance api-demo-renamed.test (b5f82fa7-b8e4-44aa-9dda-df02dab71d6c) has been updated
$ civo instance show api-demo-renamed.test
ID : 715f95d1-3cee-4a3c-8759-f9b49eec34c4
Hostname : api-demo-renamed.test
Status : ACTIVE
Size : g3.small
Cpu Cores : 1
Ram : 2048
SSD disk : 25
Region : LON1
Network ID : 28244c7d-b1b9-48cf-9727-aebb3493aaac
Disk image ID : ubuntu-bionic
Snapshot ID :
Initial User : demo-user
Initial Password : demo-user
SSH Key :
Firewall ID : c9e14ae8-b8eb-4bae-a687-9da4637233da
Tags :
Created At : Mon, 01 Jan 0001 00:00:00 UTC
Private IP : 192.168.1.7
Public IP : 74.220.21.246
----------------------------- NOTES -----------------------------
Hello, world!
如果只想更新其中一个字段,可以省略 --name 或 --notes 开关。
升级(调整大小)实例
只要 Civo 配额有剩余,就可以增大任何实例。可以使用 civo instance upgrade instanceID/hostname new_size 升级实例,其中 new_size 需从 civo sizes ls 列出的规格中选择:
$ civo instance upgrade api-demo-renamed.test g3.medium
The instance api-demo-renamed.test (9579d478-a09e-4196-a08c-f52545a90fea) is being upgraded to g3.medium
$ civo instance show api-demo-renamed.test
Status : ACTIVE
Size : g3.medium
Cpu Cores : 2
Ram : 4096
SSD disk : 50
Region : LON1
Network ID : 28244c7d-b1b9-48cf-9727-aebb3493aaac
Disk image ID : ubuntu-bionic
Snapshot ID :
Initial User : demo-user
Initial Password : demo-user
SSH Key :
Firewall ID : c9e14ae8-b8eb-4bae-a687-9da4637233da
Tags : ubuntu, demo
Created At : Mon, 01 Jan 0001 00:00:00 UTC
Private IP : 192.168.1.9
Public IP : 74.220.17.71
----------------------------- NOTES -----------------------------
Hello, world!
请注意,调整大小可能需要几分钟。
恢复模式
恢复模式可将实例启动到恢复环境中,以便进行故障排除。
# Enable recovery mode for an instance
civo instance recovery enable INSTANCE_ID/HOSTNAME
# Disable recovery mode for an instance
civo instance recovery disable INSTANCE_ID/HOSTNAME
# Check recovery mode status
civo instance recovery-status INSTANCE_ID/HOSTNAME
recovery-status 命令支持使用以下字段自定义输出格式:
- id - 实例 ID
- hostname - 实例主机名
- status - 当前恢复模式状态
VNC/控制台访问
console 命令可让你通过基于浏览器的 VNC 控制台访问实例。
# Open VNC console (default duration)
civo instance console INSTANCE_ID/HOSTNAME
# Open VNC console with custom duration
civo instance console INSTANCE_ID/HOSTNAME --duration 2h
--duration 标志接受 Go 的时长格式:
- "30m" - 30 分钟
- "1h" - 1 小时
- "24h" - 24 小时
执行后,该命令将:
- 为指定实例启用 VNC 访问
- 生成安全的 VNC URL
- 自动在默认浏览器中打开控制台
- 最多尝试连接 35 秒,超时后停止
# Check the status of a VNC/console session
civo instance console status INSTANCE_ID/HOSTNAME
# Stop an active VNC/console session
civo instance console stop INSTANCE_ID/HOSTNAME
Kubernetes 集群
简介
你可以使用 Kubernetes 子命令管理 Civo 上的 Kubernetes 集群。
列出集群
若要查看已创建的集群,请运行 civo kubernetes list:
$ civo kubernetes list
+--------------------------------------+----------------+--------+-------+-------+--------+
| ID | Name | Region | Nodes | Pools | Status |
+--------------------------------------+----------------+--------+-------+-------+--------+
| 5604340f-caa3-4ac1-adb7-40c863fe5639 | falling-sunset | NYC1 | 2 | 1 | ACTIVE |
+--------------------------------------+----------------+--------+-------+-------+--------+
列出 kubernetes 规格
运行 civo kubernetes size 即可列出所有 kubernetes 规格。
$ civo kubernetes size
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| Name | Description | Type | CPU Cores | RAM MB | SSD GB | Selectable |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| g4s.kube.xsmall | Extra Small - Standard | Kubernetes | 1 | 1024 | 30 | Yes |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| g4s.kube.small | Small - Standard | Kubernetes | 1 | 2048 | 40 | Yes |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| g4s.kube.medium | Medium - Standard | Kubernetes | 2 | 4096 | 50 | Yes |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| g4s.kube.large | Large - Standard | Kubernetes | 4 | 8192 | 60 | Yes |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| g4p.kube.small | Small - Performance | Kubernetes | 4 | 16384 | 60 | Yes |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| g4p.kube.medium | Medium - Performance | Kubernetes | 8 | 32768 | 80 | Yes |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| g4p.kube.large | Large - Performance | Kubernetes | 16 | 65536 | 120 | Yes |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| g4p.kube.xlarge | Extra Large - Performance | Kubernetes | 32 | 131072 | 180 | Yes |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| g4c.kube.small | Small - CPU optimized | Kubernetes | 8 | 16384 | 60 | Yes |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| g4c.kube.medium | Medium - CPU optimized | Kubernetes | 16 | 32768 | 80 | Yes |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| g4c.kube.large | Large - CPU optimized | Kubernetes | 32 | 65536 | 120 | Yes |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| g4c.kube.xlarge | Extra Large - CPU optimized | Kubernetes | 64 | 131072 | 180 | Yes |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| g4m.kube.small | Small - RAM optimized | Kubernetes | 2 | 16384 | 60 | Yes |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| g4m.kube.medium | Medium - RAM optimized | Kubernetes | 4 | 32768 | 80 | Yes |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| g4m.kube.large | Large - RAM optimized | Kubernetes | 8 | 65536 | 120 | Yes |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| g4m.kube.xlarge | Extra Large - RAM optimized | Kubernetes | 16 | 131072 | 180 | Yes |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| g4g.kube.small | Small - Nvidia A100 80GB | Kubernetes | 12 | 131072 | 100 | Yes |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| g4g.kube.medium | Medium - Nvidia A100 80GB | Kubernetes | 24 | 262144 | 100 | Yes |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| g4g.kube.large | Large - Nvidia A100 80GB | Kubernetes | 48 | 524288 | 100 | Yes |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| g4g.kube.xlarge | Extra Large - Nvidia A100 80GB | Kubernetes | 96 | 1048576 | 100 | Yes |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| g4g.40.kube.small | Small - Nvidia A100 40GB | Kubernetes | 8 | 65536 | 200 | Yes |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| g4g.40.kube.medium | Medium - Nvidia A100 40GB | Kubernetes | 16 | 131072 | 400 | Yes |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| g4g.40.kube.large | Large - Nvidia A100 40GB | Kubernetes | 32 | 262133 | 400 | Yes |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| g4g.40.kube.xlarge | Extra Large - Nvidia A100 40GB | Kubernetes | 64 | 524288 | 400 | Yes |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| an.g1.l40s.kube.x1 | Small - Nvidia L40S 40GB | Kubernetes | 12 | 131072 | 200 | Yes |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| an.g1.l40s.kube.x2 | Medium - Nvidia L40S 40GB | Kubernetes | 24 | 262133 | 200 | Yes |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| an.g1.l40s.kube.x4 | Large - Nvidia L40S 40GB | Kubernetes | 48 | 524288 | 400 | Yes |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| an.g1.l40s.kube.x8 | Extra Large - Nvidia L40S 40GB | Kubernetes | 96 | 1048576 | 400 | Yes |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
创建集群
运行 civo kubernetes create 并提供集群名称参数及所需选项,即可创建集群:
-a, --applications string optional, use names shown by running 'civo kubernetes applications ls'
-p, --cni-plugin string optional, possible options: flannel,cilium. (default "flannel")
-c, --create-firewall optional, create a firewall for the cluster with all open ports
-e, --existing-firewall string optional, ID of existing firewall to use
-u, --firewall-rules string optional, can be used if the --create-firewall flag is set, semicolon-separated list of ports to open (default "default")
-h, --help help for create
-m, --merge merge the config with existing kubeconfig if it already exists.
-t, --network string the name of the network to use in the creation (default "default")
-n, --nodes int the number of nodes to create (the master also acts as a node). (default 3)
-r, --remove-applications string optional, remove default application names shown by running 'civo kubernetes applications ls'
--save save the config
-s, --size string the size of nodes to create. (default "g4s.kube.medium")
--switch switch context to newly-created cluster
-v, --version string the k3s version to use on the cluster. Defaults to the latest. Example - 'civo k3s create --version 1.21.2+k3s1' (default "latest")
-w, --wait a simple flag (e.g. --wait) that will cause the CLI to spin and wait for the cluster to be ACTIVE
注意
- 如果未使用 '--firewall-rules','--create-firewall' 将在防火墙中开放端口 80、443 和 6443。
- '--create-firewall' 和 '--existing-firewall' 标志不能同时使用。
- '--firewall-rules' 标志必须与 '--create-firewall' 一起使用。
- '--firewall-rules' 标志接受以下内容:
- 可以传入 'all' 以开放所有端口。
- 可选的结束端口,格式为 'start_port-end_port'(例如 8000-8100)
- 可选的 CIDR 表示法(例如 0.0.0.0/0)
- 未提供 CIDR 表示法时,端口默认使用 0.0.0.0/0(向公网开放)作为 CIDR 表示法
- 提供的 CIDR 表示法不含斜杠和数字段时,默认使用 /32
- 在同一条规则中,可以使用逗号分隔多个端口,使其使用相同的 CIDR 表示法
- 若要分隔多条规则,可以使用分号,并将所有内容用双引号括起来(见下文) 以下示例均有效:
- "80,443,6443:0.0.0.0/0;8080:1.2.3.4"(向公网开放 80、443、6443,仅向 1.2.3.4/32 开放 8080)
- "80,443,6443;6000-6500:4.4.4.4/24"(向公网开放 80、443、6443,仅向 4.4.4.4/24 开放 6000 到 6500)
$ civo kubernetes create my-first-cluster
Created Kubernetes cluster my-first-cluster
向集群添加节点池
集群运行时,可以在线向集群添加更多节点池(显然,最少为 1 个)。该命令接受集群名称(或 ID)、--nodes 参数(要运行的新节点数)和 --size 参数(节点池的规格)。
如果未指定 --node 和 --size,则会使用默认值。
civo kubernetes node-pool create my-first-cluster
The pool (8064c7) was added to the cluster (my-first-cluster)
在集群中扩缩节点池
集群运行期间,你可以扩缩集群中的节点池。命令需要指定集群名称(或 ID)、节点池 ID(至少 6 个字符),以及 --nodes,用于指定节点池中的新节点数量。你可以通过 civo k3s show my-first-cluster 获取节点池 ID 详情。
civo kubernetes node-pool scale my-first-cluster pool-id --nodes 5
删除集群中的节点池
你可以删除集群中的节点池。命令需要指定集群名称(或 ID)和节点池 ID(至少 6 个字符)。
civo kubernetes node-pool delete my-first-cluster pool-id
回收集群中的节点
如果出于任何原因需要回收集群中的特定节点,可以使用 recycle 命令。此命令需要指定集群名称或 ID,以及要回收的节点名称,并在节点名称前加上 --node=:
$ civo k8s recycle my-first-cluster --node=k3s-my-first-cluster-5ae1561e-node-pool-a56f
The node (k3s-my-first-cluster-5ae1561e-node-pool-a56f) was recycled
_注意:_回收节点时,该节点会被彻底删除。recycle 命令不会对节点进行排空,而是直接删除节点,然后创建一个新节点并将其连接到集群。此命令适用于节点本身出现问题、必须更换为新节点的情况。
查看或保存集群配置
要输出集群的配置信息,可以运行 civo kubernetes config cluster-name。这会在屏幕上输出 kubeconfig 文件。
你可以将集群配置保存到本地 ~/.kube/config 文件中。此操作需要安装 kubectl。用法如下:
civo kubernetes config my-first-cluster -s
Saved config to ~/.kube/config
如果你已经有 ~/.kube/config 文件,保存的任何集群配置都会被_覆盖_,除非同时传入 --merge 选项。如果你有多个集群配置,合并后即可随时切换上下文。如果想将配置保存到其他位置,只需使用参数 --local-path 或 -p 并指定路径。如果使用 --switch,CLI 会自动将 Kubernetes 上下文切换到新集群。
civo kubernetes config my-first-cluster -s --merge
Merged with main kubernetes config: /root/.kube/config
Saved configuration to: /root/.kube/config
Access your cluster with:
kubectl config use-context my-first-cluster
kubectl get node
重命名集群
集群名称只会显示在集群列表中(例如,它不会以任何方式写入集群本身)。如果要重命名集群,可以运行:
civo kubernetes rename my-first-cluster --name="Production"
Kubernetes cluster my-first-cluster is now named Production
创建不包含默认应用的集群
默认情况下,Traefik 会与 k3s 一起打包。如果要创建不含 Traefik 的集群,可以在创建命令中使用 remove-applications 选项:
civo kubernetes create --remove-applications=Traefik-v2-nodeport --nodes=2 --wait
命令使用通过运行 civo kubernetes applications ls 显示的应用名称。
删除集群
如果你已完全不再需要某个集群,可以运行以下命令将其删除:
civo kubernetes remove my-first-cluster
Kubernetes 应用
简介
你可以通过命令行界面,从应用市场安装应用。安装方式取决于你是要创建新集群,还是要向现有集群添加应用。
列出可用应用
要获取应用市场中最新的可用应用列表,请运行 civo kubernetes apps list。本文撰写时,列表如下:
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| Name | Version | Category | Plans | Dependencies |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| acorn | 0.7.1 | management | Disabled Auto-TLS, Enabled Auto-TLS | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| ambassador-edge-stack | 3.8.0 | architecture | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| apisix-ingress-controller | 1.6.0 | architecture | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| argo-rollouts | v1.4.1 | ci_cd | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| argo-workflows | v3.0.3 | ci_cd | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| argocd | v2.11.4 | ci_cd | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| aspnet | 5.0.5 | management | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| atmo | 0.2.2 | architecture | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| bitwarden-passwordless-dev | 1.0.74 | management | | cert-manager |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| bitwarden-unified | 2024.1.0 | management | | cert-manager |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| blackbox-exporter | 5.8.2 | monitoring | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| cerbos | 0.34.0 | security | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| cert-manager | v1.15.1 | architecture | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| chaos-mesh | (default) | ci_cd | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| civo-cluster-autoscaler | v1.25.0 | management | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| code-server | 3.11.1 | management | 1GB, 2GB, 5GB | cert-manager |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| dapr | 1.11.0 | architecture | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| devtron | | ci_cd | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| dynamic-pv-scaler | 0.1.0 | storage | | prometheus-operator |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| edp | 3.8.1 | ci_cd | GitHub, GitLab | argocd, tekton, traefik2-nodeport |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| enroute-onestep | 0.8.0 | architecture | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| epinio | v1.11.1 | management | | cert-manager |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| falco | 0.27 | security | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| ferretdb | 1.22.0 | database | 5GB, 10GB, 20GB | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| flagsmith | 0.39.0 | ci_cd | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| flux | Latest | ci_cd | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| gatekeeper | 3.4.0 | security | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| ghost | 5.87.1 | management | 5GB, 10GB, 15GB | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| gimlet | v0.17.2 | management | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| gitea | 1.12.5 | management | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| gitlab | 16.2.3 | management | Community edition, Enterprise edition | cert-manager |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| gloo-edge | latest | architecture | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| haproxy | 1.5 | architecture | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| helm | 2.16.5 | management | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| istio | multiple | architecture | Istio Latest, Istio v1.10.1, Istio v1.9.5, Istio v1.8.6 | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| jenkins | 2.452.2 | ci_cd | 5GB, 10GB, 20GB | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| joomla | 5.2 | management | 5GB, 10GB, 20GB | mariadb:5GB, cert-manager |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| kafka | 2.7.0 | architecture | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| keda | 2.14.0 | architecture | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| keptn | 0.8.7 | ci_cd | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| ketch | 0.7.0 | management | | cert-manager |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| keycloak | 25.0.1 | security | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| kong-ingress-controller | 3.0.1 | architecture | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| kriten | 4.0.1 | architecture | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| kube-hunter | latest | security | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| kubeclarity | Latest | security | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| kubefirst | v2.4.6 | management | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| kubeflow | 1.6.0-rc.1 | management | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| kubenav | 3.1.0 | management | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| kubernetes-dashboard | v2.4.0 | management | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| kubernetes-external-secrets | 0.9.14 | security | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| kubesphere | v3.4.1 | management | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| kubevela | 1.0.1 | management | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| kubevious | v1.0.3 | management | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| kubewarden | v1.14.0 | security | | cert-manager |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| kyverno | 1.8.2 | security | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| linkerd | Latest | architecture | Linkerd Minimal, Linkerd & Jaeger, Linkerd with Dashboard, Linkerd with Dashboard & Jaeger | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| litmuschaos | 2.0.0 | ci_cd | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| loki | v2.9.11 | monitoring | | prometheus-operator |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| longhorn | 1.3.2 | storage | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| maesh | v1.4.5 | architecture | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| mariadb | 11.4.2 | database | 5GB, 10GB, 20GB | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| metrics-server | (default) | architecture | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| minio | 2019-08-29 | storage | 5GB, 10GB, 20GB | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| mongodb | 4.2.12 | database | 5GB, 10GB, 20GB | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| netdata | Latest | monitoring | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| neuvector | latest | security | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| nextcloud | 29.0.3 | management | 5GB, 10GB, 20GB | mariadb:5GB, cert-manager |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| nexus3 | 3.30.1 | ci_cd | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| nginx | latest | architecture | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| ngrok-ingress-controller | 0.12.1 | architecture | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| nodered | 1.2.7 | architecture | 5GB, 10GB, 20GB | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| openfaas | 0.18.0 | architecture | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| openobserve | v0.8.1 | monitoring | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| otomi | 1.0.0 | management | | metrics-server |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| paralus | 0.2.3 | security | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| parca | v0.15.0 | monitoring | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| percona-mysql | 1.11.0 | database | 10GB, 20GB, 50GB | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| permission-manager | 1.6.0 | management | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| pmm | 2.36.0 | monitoring | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| polaris | 7.3.2 | security | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| portainer | 2.16.2 | management | Community edition, Business edition | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| postgresql | 16.3 | database | 5GB, 10GB, 20GB | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| projectsveltos | v0.29.1 | management | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| prometheus-operator | 0.38.1 | monitoring | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| pyroscope | 0.2.5 | monitoring | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| rabbitmq | 3.13.4-management | architecture | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| rancher | 2.8.5 | management | | cert-manager |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| redis | 7.2-alpine | database | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| rekor | 0.2.2 | architecture | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| reloader | v0.0.125 | architecture | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| rqlite | 8.26.6 | database | 1GB, 5GB, 10GB, 3Replicas | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| sealed-secrets | v0.26.2 | architecture | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| selenium | 4 | ci_cd | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| shipa | 1.7.2 | management | | cert-manager |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| siglens-oss | 0.1.22 | monitoring | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| spinkube | v0.1.0 | management | | cert-manager |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| system-upgrade-controller | v0.6.2 | architecture | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| tekton | v0.50.5 | ci_cd | | metrics-server |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| traefik2-loadbalancer | 2.11.0 | architecture | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| traefik2-nodeport | 2.9.4 | architecture | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| unifi-controller | stable-6 | management | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| uptime-kuma | 1.23.3 | monitoring | 1GB, 2GB | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| vault | 0.24.0 | security | Standalone, Dev, High-Availability | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| volcano | v1.9.0 | management | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| weavescope | v1.13.2 | monitoring | | |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
| wordpress | 5.6.2 | management | 5GB, 10GB, 20GB | mariadb:5GB |
+-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+
查看已安装到集群中的应用详情
此选项可让你查看集群中每个已安装应用的安装后说明。
civo kubernetes application show Traefik apps-demo-cluster
第一个参数是应用名称,第二个参数是集群名称。
在新集群上安装应用
要指定在新集群上安装的应用,请在创建集群时列出它们,并使用上方列表中的 name:
civo kubernetes create apps-demo-cluster --nodes=2 --applications=Redis,Linkerd
现在查看集群详情,即可看到新安装的应用:
$ civo kubernetes show apps-demo
ID : 1199efbe-e2a5-4d25-a32f-0b7aa50082b2
Name : apps-demo-cluster
# Nodes : 2
Size : g2.medium
Status : ACTIVE
Version : 0.8.1
API Endpoint : https://[Cluster-IP]:6443
Master IP : [Cluster-IP]
DNS A record : 1199efbe-e2a5-4d25-a32f-0b7aa50082b2.k8s.civo.com
Nodes:
+------------------+----------------+--------+
| Name | IP | Status |
+------------------+----------------+--------+
| kube-master-1e91 | (IP) | ACTIVE |
| kube-node-e678 | (IP) | ACTIVE |
+------------------+----------------+--------+
Installed marketplace applications:
+---------+-----------+-----------+--------------+
| Name | Version | Installed | Category |
+---------+-----------+-----------+--------------+
| Traefik | (default) | Yes | architecture |
| Linkerd | 2.5.0 | Yes | architecture |
| Redis | 3.2 | Yes | database |
+---------+-----------+-----------+--------------+
注意:metrics-server 等应用默认会安装到你创建的所有新集群中。如果不需要安装默认应用,请使用以下 --remove-applications 标志:
civo kubernetes create apps-demo-cluster --nodes=2 --applications=Redis,Linkerd --remove-applications=metrics-server
在现有集群中安装应用程序
如果要在现有集群中添加新应用程序,可以运行 civo applications 命令,并指定集群和要添加的应用程序:
$ civo kubernetes applications add Longhorn --cluster=apps-demo
Added Longhorn 0.5.0 to Kubernetes cluster apps-demo-cluster
安装需要计划的应用程序
某些应用程序,尤其是数据库应用程序,需要存储计划。你可以在安装时从计划选项列表中指定计划。如果未为需要计划的应用程序提供计划,CLI 会通知你并建议一个默认大小:
$ civo kubernetes applications add mariadb --cluster=apps-demo
You requested to add MariaDB but didn't select a plan. Please choose one... (5GB, 10GB, 20GB) [5GB]: 10GB
Thank you, next time you could use "MariaDB:10GB" to choose automatically
Added MariaDB 10.4.7 to Kubernetes cluster apps-demo-cluster
域名和域名记录
简介
我们会自动为所有实例托管反向 DNS。如果你想管理域名的正向(常规)DNS,可以在你的账户中免费进行管理。
本节实际上分为两部分:1)管理域名本身;2)管理这些域名中的记录。
我们不提供域名注册服务,只提供 DNS 托管。如果你想购买域名,我们推荐 LCN.com,他们提供出色、友好的支持,价格也非常有竞争力。
设置新域名
任何用户都可以将已在其他地方注册的域名添加到 Civo.com 进行管理。你应通过域名注册商调整域名的名称服务器,使其指向 ns0.civo.com 和 ns1.civo.com。
设置新域名的命令是 civo domain create domainname:
$ civo domain create civoclidemo.xyz
Created a domain called civoclidemo.xyz with ID 418181b2-fcd2-46a2-ba7f-c843c331e79b
然后,你可以继续为该域名添加 DNS 记录。
列出域名
若要查看已创建的域名,请调用 civo domain list:
$ civo domain list
+--------------------------------------+-----------------+
| ID | Name |
+--------------------------------------+-----------------+
| 418181b2-fcd2-46a2-ba7f-c843c331e79b | civoclidemo.xyz |
+--------------------------------------+-----------------+
删除域名
如果要删除域名,可以调用 civo domain remove domain_id,系统会立即删除该域名及其关联的所有 DNS 记录。此操作会立即生效,请谨慎使用。
创建 DNS 记录
DNS 记录创建命令采用以下格式,并接受多个选项:civo domain record create domain_id [options]。选项如下。
Options:
-n, --name string the name of the record
-p, --priority int the priority of record only for MX record
-t, --ttl int The TTL of the record (default 600)
-e, --type string type of the record (A, CNAME, TXT, SRV, MX)
-v, --value string the value of the record
用法如下:
$ civo domain record create civoclidemo.xyz -n www -t 600 -e A -v 192.168.1.1
Created a record www1 for civoclidemo.xyz with a TTL of 600 seconds and with a priority of 0 with ID 4e181dde-bde8-4744-8984-067f957a7d59
列出 DNS 记录
你可以通过请求 civo domain record list domain.name,查看为特定域名创建的所有记录的概览:
$ civo domain record list civoclidemo.xyz
+--------------------------------------+------+---------------------+-------------+------+----------+
| ID | Type | Name | Value | TTL | Priority |
+--------------------------------------+------+---------------------+-------------+------+----------+
| 4e181dde-bde8-4744-8984-067f957a7d59 | A | www.civoclidemo.xyz | 192.168.1.1 | 1000 | 0 |
+--------------------------------------+------+---------------------+-------------+------+----------+
删除 DNS 记录
你可以通过请求 civo domain record remove record_id,从你拥有的域名中删除特定 DNS 记录。此操作会立即删除关联记录,请谨慎使用:
$ civo domain record remove 4e181dde-bde8-4744-8984-067f957a7d59
The domain record called www with ID 4e181dde-bde8-4744-8984-067f957a7d59 was deleted
防火墙
简介
你可以使用 Civo CLI 的防火墙组件为实例配置自定义防火墙规则。这些规则可以自由配置,但客户应谨慎操作,避免无法再访问自己的实例。默认情况下,自定义防火墙的所有端口均处于关闭状态。
防火墙可以通过规则进行配置,之后你可以使用相应命令将其应用于所选实例。
配置新防火墙
若要创建新防火墙,请使用 civo firewall create new_firewall_name:
$ civo firewall create civocli_demo
Created a firewall called civocli_demo with ID ab2a25d7-edd4-4ecd-95c4-58cb6bc402de
默认情况下,新创建的防火墙会应用默认规则。
若要创建不包含任何默认规则的防火墙,请使用 --no-default-rules 标志:
civo firewall create new_firewall_name --no-default-rules
你也可以使用设为 false 的 -r 或 --create-rules 标志创建不含默认规则的防火墙,但此用法已弃用,并将在未来版本中移除。两种情况下的用法如下:
civo firewall create new_firewall_name --create-rules=false
然后,你可以使用 civo firewall rule create firewall_id 添加新规则,并提供必需参数和你选择的可选参数,从而配置规则,允许与实例建立连接。参数如下所列,示例见下文:
Options:
-a, --action string the action of the rule can be allow or deny (default is allow) (default "allow")
-c, --cidr string the CIDR of the rule you can use (e.g. -c 10.10.10.1/32,148.2.6.120/32) (default "0.0.0.0/0")
-d, --direction string the direction of the rule can be ingress or egress (default is ingress) (default "ingress")
-e, --endport string the end port of the rule
-h, --help help for create
-l, --label string a string that will be the displayed as the name/reference for this rule
-p, --protocol string the protocol choice (TCP, UDP, ICMP) (default "TCP")
-s, --startport string the start port of the rule
用法示例:
$ civo firewall rule create civocli_demo --startport=22 --direction=ingress --label='SSH access for CLI demo' -a allow
New rule SSH access for CLI demo created
$ civo firewall rule list civocli_demo
+--------------------------------------+-----------+----------+------------+----------+--------+-----------+-------------------------+
| ID | Direction | Protocol | Start Port | End Port | Action | Cidr | Label |
+--------------------------------------+-----------+----------+------------+----------+--------+-----------+-------------------------+
| 74fff0d7-0ba4-497b-bbc1-83179b4e3b23 | ingress | tcp | 22 | 22 | allow | 0.0.0.0/0 | SSH access for CLI demo |
+--------------------------------------+-----------+----------+------------+----------+-----------+----------------------------------+
你可以调用 civo firewall rule ls firewall_id,查看特定防火墙的所有生效规则,其中 firewall_id 是相应防火墙的 UUID。
管理防火墙
运行 civo firewall list,即可查看防火墙概览,其中会显示已配置规则的防火墙,以及是否有实例正在使用某个防火墙。例如,在此处,我们刚刚配置的防火墙有一条规则,但没有实例使用它。
$ civo firewall list
+--------------------------------------+--------------------+---------+-------------+-----------------+----------------+--------------------+
| ID | Name | Network | Total rules | Total Instances | Total Clusters | Total LoadBalancer |
+--------------------------------------+--------------------+---------+-------------+-----------------+----------------+--------------------+
| 3ac0681d-2f71-4921-ae20-019272d9248b | Default (all open) | Default | 3 | 0 | 0 | 0 |
+--------------------------------------+--------------+-------------+----------------+----------------+----------------+--------------------+
如需将实例配置为使用特定防火墙,请参阅本指南中的实例/在其他位置设置防火墙。
如需查看特定防火墙规则的详细信息,可以使用 civo firewall rule list firewall_id。
删除防火墙规则和防火墙
只需调用 civo firewall rule remove firewall_id rule_id,并确认要删除规则所属的防火墙 ID,即可移除防火墙规则,如下所示:
$ civo firewall rule remove 09f8d85b-0cf1-4dcf-a472-ba247fb4be21 4070f87b-e6c6-4208-91c5-fc4bc72c1587
Removed Firewall rule 4070f87b-e6c6-4208-91c5-fc4bc72c1587
$ civo firewall rule list 09f8d85b-0cf1-4dcf-a472-ba247fb4be21
同样,调用 civo firewall remove firewall_id 即可删除防火墙:
$ civo firewall remove 09f8d85b-0cf1-4dcf-a472-ba247fb4be21
Removed firewall 09f8d85b-0cf1-4dcf-a472-ba247fb4be21
$ civo firewall list
网络
简介
如果你想将实例彼此隔离,Civo 支持真正的私有网络。例如,你可以设置三个实例,将其中一个用作 堡垒主机和负载均衡器,其他实例则分别充当数据库服务器和应用服务器,且两者都仅使用私有 IP。
查看网络
运行 civo network list,即可列出当前已配置的网络。列表会显示网络 ID、名称标签和 CIDR 范围。
创建网络
使用 civo network create network_label 可以创建新的专用网络:
$ civo network create cli-demo
Create a private network called cli-demo with ID 74b69006-ea59-46a0-96c4-63f5bfa290e1
列出网络
运行 civo network ls 可以列出所有网络。
$ civo network ls
+--------------------------------------+----------+--------+---------+
| ID | Label | Region | Default |
+--------------------------------------+----------+--------+---------+
| 28244c7d-b1b9-48cf-9727-aebb3493aaac | Default | LON1 | true |
| fa21edfa-c089-421c-8008-0c0c7784386a | test | LON1 | false |
| 35ec87e7-fbd2-4ee8-849a-f88d7363e23f | cli-demo | LON1 | false |
+--------------------------------------+----------+--------+---------+
移除网络
如果不再需要某个网络,并且应用不依赖经由该网络进行路由,移除它很简单——调用 civo network remove network_ID 即可:
$ civo network remove 74b69006-ea59-46a0-96c4-63f5bfa290e1
Removed the network cli-demo with ID 74b69006-ea59-46a0-96c4-63f5bfa290e1
对象存储
简介
对象存储是 Civo 上兼容 S3 的数据存储结构。在你的账户中创建对象存储后,你可以在每个对象存储的大小限制和配额范围内管理非结构化数据。
列出对象存储
运行 civo objectstore ls,即可获取账户中所有对象存储的列表。
$ civo objectstore ls
+--------+----------+------+---------------------------+--------+
| ID | Name | Size | Object Store Endpoint | Status |
+--------+----------+------+---------------------------+--------+
| 699e42 | cli-demo | 500 | objectstore.lon1.civo.com | ready |
| 083e59 | test | 500 | objectstore.lon1.civo.com | ready |
+--------+----------+------+---------------------------+--------+
创建对象存储
运行 civo objectstore create 并提供对象存储名称参数,即可创建对象存储。你也可以使用 --size 标志指定大小。如果未指定大小,默认值为 500GB。如果未指定 --region 标志,对象存储将在当前启用的区域中创建。
$ civo objectstore create cli-demo
Creating Object Store cli-demo in LON1
To check the status of the Object Store run: civo objectstore show cli-demo
更新对象存储
只要 Civo 配额有足够空间,就可以运行 civo objectstore update,并提供对象存储名称和新大小,以更新对象存储的大小。
$ civo objectstore update cli-demo --size=1000
The Object Store with ID 699e42a7-918b-42f7-ac22-fb9869e835ad was updated to size: 1000 GB
删除对象存储
运行 civo objectstore delete 并提供对象存储名称,即可删除对象存储。
$ civo objectstore delete cli-demo
Warning: Are you sure you want to delete the cli-demo Object Store (y/N) ? y
The Object Store (cli-demo) has been deleted
对象存储凭据
简介
对象存储的访问权限由凭据管理控制。创建新的对象存储时,系统会同时创建一组默认的管理员凭据。你可以为创建的对象存储创建其他凭据,并导出凭据信息供应用使用。
列出对象存储凭据
运行 civo objectstore credential ls,即可获取账户中所有对象存储凭据的列表。
$ civo objectstore credential ls
+----------------------+----------------------+--------+
| Name | Access Key | Status |
+----------------------+----------------------+--------+
| cli-demo-xazd-7de9b2 | 3W-X-Y-X-Y-X-Y-X-Y-X | ready |
| cli-demo-fa5d-fe8d50 | QW-X-Y-X-Y-X-Y-X-Y-N | ready |
+----------------------+----------------------+--------+
创建对象存储凭据
运行 civo objectstore credential create 并提供凭据名称参数,即可创建对象存储凭据。你也可以分别使用 ----access-key 和 --secret-key 标志指定访问密钥和秘密访问密钥。如果未提供这些标志,我们会为你生成这两个密钥。
$ civo objectstore credential create cli-demo-credential --access-key=YOUR_ACCESS_KEY --secret-key=YOUR_SECRET_KEY
Creating Object Store Credential cli-demo-credential in LON1
导出凭据
你可以运行 civo objectstore credential export 并提供凭据的访问密钥来导出凭据。我们支持导出为 2 种格式:env 和 s3cfg。有关凭据导出格式的更多信息,请参阅 civo objectstore credential export --help 中的帮助文本。
如果未传入 --format 标志,默认会导出为 env 格式。
$ civo objectstore credential export --access-key=YOUR_ACCESS_KEY
# Tip: You can redirect output with (>> ~/.zshrc) to add these to Zsh's startup automatically
export AWS_ACCESS_KEY_ID=YOUR_ACCESS_KEY
export AWS_SECRET_ACCESS_KEY=YOUR_SECRET_KEY
export AWS_DEFAULT_REGION=LON1
export AWS_HOST=https://objectstore.lon1.civo.com
删除对象存储凭据
你可以运行 civo objectstore credential delete 并将凭据名称作为参数来删除对象存储凭据。
$ civo objectstore credential delete cli-demo-fa5d-7de9b2
Warning: Are you sure you want to delete the cli-demo-fa5d-7de9b2 Object Store Credential (y/N) ? y
The Object Store Credential (cli-demo-fa5d-7de9b2) has been deleted
磁盘映像
Civo CLI 通过 diskimage 命令提供全面的磁盘映像管理功能。此功能可让你列出、创建、查看和删除 Civo 账户中的磁盘映像。
列出磁盘映像
civo diskimage ls [--custom]
列出所有可用的磁盘映像。使用 --custom 标志可仅在列表中显示你的自定义映像。
可用的输出字段:
- id
- name
- version
- state
- distribution
自定义格式示例:
civo diskimage ls -o=custom -f=id,name
创建磁盘映像
civo diskimage create --name NAME --distribution DISTRO --version VERSION --path PATH [--os TYPE] [--logo_path LOGO]
必需标志:
--name, -n:磁盘映像名称--distribution, -d:发行版名称(例如 ubuntu、centos)--version, -v:发行版版本--path, -p:磁盘映像文件的路径
可选标志:
--os, -t:操作系统类型(linux/windows,默认为 linux)--logo_path, -l:SVG 徽标文件的路径
要求:
- 磁盘映像必须为
.raw或.qcow2格式 - 徽标必须为 SVG 格式
查看磁盘映像详情
civo diskimage show ID/NAME
按磁盘映像的 ID 或名称查找并显示详情。
删除磁盘映像
civo diskimage delete ID/NAME
从你的账户中删除磁盘映像。
注意: 所有磁盘映像操作均遵循当前所选区域。
配额
所有加入 Civo 的客户,其账户都会应用默认配额。配额与费用或付款无关,而是限制你可同时使用的资源数量。你可以随时运行 civo quota show 查看配额状态。以下是撰写本文时我的当前配额使用情况:
$ civo quota show
+------------------+-------+-------+
| Item | Usage | Limit |
+------------------+-------+-------+
| Instances | 4 | 16 |
| CPU cores | 5 | 16 |
| RAM MB | 7168 | 32768 |
| Disk GB | 150 | 400 |
| Volumes | 4 | 16 |
| Snapshots | 1 | 48 |
| Public IPs | 4 | 16 |
| Subnets | 1 | 10 |
| Private networks | 1 | 10 |
| Firewalls | 1 | 16 |
| Firewall rules | 1 | 160 |
+------------------+-------+-------+
Any items in red are at least 80% of your limit
如果你有正当理由需要提高配额,请访问配额页面提交申请。我们不会无故拒绝提高配额;设置配额只是为了控制平台的增长速度,并避免使用我们 API 的临时脚本突然耗尽可用资源。
规格
Civo 实例提供多种规格,以满足不同的需求和预算。你可以通过运行 civo sizes list 获取可用实例规格的详细信息。结果大致如下,具体内容取决于你所选的区域:
$ civo sizes list
+--------------------+--------------------------------+------------+-----+---------+-----+
| Name | Description | Type | CPU | RAM | SSD |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g3.xsmall | Extra Small | Instance | 1 | 1024 | 25 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g3.small | Small | Instance | 1 | 2048 | 25 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g3.medium | Medium | Instance | 2 | 4096 | 50 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g3.large | Large | Instance | 4 | 8192 | 100 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g3.xlarge | Extra Large | Instance | 6 | 16384 | 150 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g3.2xlarge | 2X Large | Instance | 8 | 32768 | 200 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4s.kube.xsmall | Extra Small - Standard | Kubernetes | 1 | 1024 | 30 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4s.kube.small | Small - Standard | Kubernetes | 1 | 2048 | 40 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4s.kube.medium | Medium - Standard | Kubernetes | 2 | 4096 | 50 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4s.kube.large | Large - Standard | Kubernetes | 4 | 8192 | 60 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4p.kube.small | Small - Performance | Kubernetes | 4 | 16384 | 60 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4p.kube.medium | Medium - Performance | Kubernetes | 8 | 32768 | 80 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4p.kube.large | Large - Performance | Kubernetes | 16 | 65536 | 120 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4p.kube.xlarge | Extra Large - Performance | Kubernetes | 32 | 131072 | 180 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4c.kube.small | Small - CPU optimized | Kubernetes | 8 | 16384 | 60 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4c.kube.medium | Medium - CPU optimized | Kubernetes | 16 | 32768 | 80 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4c.kube.large | Large - CPU optimized | Kubernetes | 32 | 65536 | 120 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4c.kube.xlarge | Extra Large - CPU optimized | Kubernetes | 64 | 131072 | 180 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4m.kube.small | Small - RAM optimized | Kubernetes | 2 | 16384 | 60 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4m.kube.medium | Medium - RAM optimized | Kubernetes | 4 | 32768 | 80 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4m.kube.large | Large - RAM optimized | Kubernetes | 8 | 65536 | 120 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4m.kube.xlarge | Extra Large - RAM optimized | Kubernetes | 16 | 131072 | 180 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g3.db.xsmall | Extra Small | Database | 1 | 2048 | 20 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g3.db.small | Small | Database | 2 | 4096 | 40 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g3.db.medium | Medium | Database | 4 | 8192 | 80 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g3.db.large | Large | Database | 6 | 16384 | 160 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g3.db.xlarge | Extra Large | Database | 8 | 32768 | 320 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g3.db.2xlarge | Double Extra Large | Database | 10 | 65536 | 640 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g3.kf.small | Small - CPU optimized | KfCluster | 4 | 16384 | 60 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g3.kf.medium | Medium - CPU optimized | KfCluster | 8 | 32768 | 80 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g3.kf.large | Large - CPU optimized | KfCluster | 16 | 65536 | 120 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g3.kf.xlarge | Extra Large - CPU optimized | KfCluster | 32 | 131072 | 180 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4s.xsmall | xSmall - Standard | Instance | 1 | 1024 | 25 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4s.small | Small - Standard | Instance | 1 | 2048 | 25 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4s.medium | Medium - Standard | Instance | 2 | 4096 | 50 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4s.large | Large - Standard | Instance | 4 | 8192 | 100 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4s.xlarge | Extra Large - Standard | Instance | 6 | 16384 | 150 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4s.2xlarge | 2X Large - Standard | Instance | 8 | 32768 | 200 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.kube.small | Small - Nvidia A100 80GB | Kubernetes | 12 | 131072 | 100 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.kube.medium | Medium - Nvidia A100 80GB | Kubernetes | 24 | 262144 | 100 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.kube.large | Large - Nvidia A100 80GB | Kubernetes | 48 | 524288 | 100 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.kube.xlarge | Extra Large - Nvidia A100 80GB | Kubernetes | 96 | 1048576 | 100 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.small | Small - Nvidia A100 80GB | Instance | 12 | 131072 | 200 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.medium | Medium - Nvidia A100 80GB | Instance | 24 | 262144 | 200 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.large | Large - Nvidia A100 80GB | Instance | 48 | 524288 | 400 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.xlarge | Extra Large - Nvidia A100 80GB | Instance | 96 | 1048576 | 400 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.40.small | Small - Nvidia A100 40GB | Instance | 8 | 65536 | 200 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.40.medium | Medium - Nvidia A100 40GB | Instance | 16 | 131072 | 400 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.40.large | Large - Nvidia A100 40GB | Instance | 32 | 262133 | 400 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.40.xlarge | Extra Large - Nvidia A100 40GB | Instance | 64 | 524288 | 400 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.40.kube.small | Small - Nvidia A100 40GB | Kubernetes | 8 | 65536 | 200 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.40.kube.medium | Medium - Nvidia A100 40GB | Kubernetes | 16 | 131072 | 400 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.40.kube.large | Large - Nvidia A100 40GB | Kubernetes | 32 | 262133 | 400 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.40.kube.xlarge | Extra Large - Nvidia A100 40GB | Kubernetes | 64 | 524288 | 400 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| an.g1.l40s.x1 | Small - Nvidia L40S 40GB | Instance | 12 | 131072 | 200 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| an.g1.l40s.x2 | Medium - Nvidia L40S 40GB | Instance | 24 | 262133 | 200 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| an.g1.l40s.x4 | Large - Nvidia L40S 40GB | Instance | 48 | 524288 | 400 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| an.g1.l40s.x8 | Extra Large - Nvidia L40S 40GB | Instance | 96 | 1048576 | 400 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| an.g1.l40s.kube.x1 | Small - Nvidia L40S 40GB | Kubernetes | 12 | 131072 | 200 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| an.g1.l40s.kube.x2 | Medium - Nvidia L40S 40GB | Kubernetes | 24 | 262133 | 200 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| an.g1.l40s.kube.x4 | Large - Nvidia L40S 40GB | Kubernetes | 48 | 524288 | 400 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| an.g1.l40s.kube.x8 | Extra Large - Nvidia L40S 40GB | Kubernetes | 96 | 1048576 | 400 |
+--------------------+--------------------------------+------------+-----+---------+-----+
如果你不记得实例类型的名称,此命令很有用——使用 CLI 工具创建实例时,需要指定实例规格名称。
你还可以使用 --filter 按类型筛选结果,可用选项为(instance、kubernetes),示例如下:
$ civo sizes list --filter kubernetes
+--------------------+--------------------------------+------------+-----+---------+-----+
| Name | Description | Type | CPU | RAM | SSD |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4s.kube.xsmall | Extra Small - Standard | Kubernetes | 1 | 1024 | 30 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4s.kube.small | Small - Standard | Kubernetes | 1 | 2048 | 40 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4s.kube.medium | Medium - Standard | Kubernetes | 2 | 4096 | 50 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4s.kube.large | Large - Standard | Kubernetes | 4 | 8192 | 60 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4p.kube.small | Small - Performance | Kubernetes | 4 | 16384 | 60 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4p.kube.medium | Medium - Performance | Kubernetes | 8 | 32768 | 80 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4p.kube.large | Large - Performance | Kubernetes | 16 | 65536 | 120 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4p.kube.xlarge | Extra Large - Performance | Kubernetes | 32 | 131072 | 180 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4c.kube.small | Small - CPU optimized | Kubernetes | 8 | 16384 | 60 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4c.kube.medium | Medium - CPU optimized | Kubernetes | 16 | 32768 | 80 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4c.kube.large | Large - CPU optimized | Kubernetes | 32 | 65536 | 120 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4c.kube.xlarge | Extra Large - CPU optimized | Kubernetes | 64 | 131072 | 180 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4m.kube.small | Small - RAM optimized | Kubernetes | 2 | 16384 | 60 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4m.kube.medium | Medium - RAM optimized | Kubernetes | 4 | 32768 | 80 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4m.kube.large | Large - RAM optimized | Kubernetes | 8 | 65536 | 120 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4m.kube.xlarge | Extra Large - RAM optimized | Kubernetes | 16 | 131072 | 180 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.kube.small | Small - Nvidia A100 80GB | Kubernetes | 12 | 131072 | 100 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.kube.medium | Medium - Nvidia A100 80GB | Kubernetes | 24 | 262144 | 100 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.kube.large | Large - Nvidia A100 80GB | Kubernetes | 48 | 524288 | 100 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.kube.xlarge | Extra Large - Nvidia A100 80GB | Kubernetes | 96 | 1048576 | 100 |
+--------------------+--------------------------------+------------+-----+---------+-----+
| g4g.40.kube.small | Small - Nvidia A100 40GB | Kubernetes | 8 | 65536 | 200 |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| g4g.40.kube.medium | Medium - Nvidia A100 40GB | Kubernetes | 16 | 131072 | 400 |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| g4g.40.kube.large | Large - Nvidia A100 40GB | Kubernetes | 32 | 262133 | 400 |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| g4g.40.kube.xlarge | Extra Large - Nvidia A100 40GB | Kubernetes | 64 | 524288 | 400 |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| an.g1.l40s.kube.x1 | Small - Nvidia L40S 40GB | Kubernetes | 12 | 131072 | 200 |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| an.g1.l40s.kube.x2 | Medium - Nvidia L40S 40GB | Kubernetes | 24 | 262133 | 200 |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| an.g1.l40s.kube.x4 | Large - Nvidia L40S 40GB | Kubernetes | 48 | 524288 | 400 |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
| an.g1.l40s.kube.x8 | Extra Large - Nvidia L40S 40GB | Kubernetes | 96 | 1048576 | 400 |
+--------------------+--------------------------------+------------+-----------+---------+--------+------------+
SSH 密钥
简介
要管理用于登录云实例的账户 SSH 密钥,Civo CLI 工具提供了以下命令。如果你还没有合适的 SSH 密钥,则需要根据具体情况生成新密钥。
上传新的 SSH 密钥
你需要提供公用 SSH 密钥的路径,才能将新密钥上传到 Civo。用法如下:civo ssh create NAME --key /path/to/FILENAME
列出 SSH 密钥
你可以运行 civo ssh list,列出当前账户持有者已知的 SSH 密钥:
$ civo sshkeys ls
+--------------------------------------+------------------+----------------------------------------------------+
| ID | Name | Fingerprint |
+--------------------------------------+------------------+----------------------------------------------------+
| 8aa45fea-a395-471c-93a6-27485a8429f3 | civo_cli_demo | SHA256:[Unique SSH Fingerprint] |
+--------------------------------------+------------------+----------------------------------------------------+
移除 SSH 密钥
你可以按 ID 调用密钥的 remove 命令来删除 SSH 密钥:
$ civo ssh remove 531d0998-4152-410a-af20-0cccb1c7c73b
Removed SSH key cli-demo with ID 531d0998-4152-410a-af20-0cccb1c7c73b
磁盘映像
简介
Civo 实例基于磁盘映像构建。目前支持 CentOS、Debian 和 Ubuntu。要创建实例,需要磁盘映像 ID,可通过运行 civo diskimage ls 查找。
列出可用的磁盘映像
$ civo diskimage ls
+--------------------------------------+-----------------+----------------+-----------+--------------+
| ID | Name | Version | State | Distribution |
+--------------------------------------+-----------------+----------------+-----------+--------------+
| 21613daa-a66b-44fc-87f5-b6db566d8f91 | ubuntu-cuda11-8 | 22.04-cuda11-8 | available | ubuntu |
+--------------------------------------+-----------------+----------------+-----------+--------------+
| a4204155-a876-43fa-b4d6-ea2af8774560 | debian-10 | 10 | available | debian |
+--------------------------------------+-----------------+----------------+-----------+--------------+
| eda67ea0-4282-4945-9b7b-d3e1cba1d987 | ubuntu-jammy | 22.04 | available | ubuntu |
+--------------------------------------+-----------------+----------------+-----------+--------------+
| d927ad2f-5073-4ed6-b2eb-b8e61aef29a8 | ubuntu-focal | 20.04 | available | ubuntu |
+--------------------------------------+-----------------+----------------+-----------+--------------+
| 13232803-0928-4634-9ab8-476bff29ef1b | ubuntu-cuda12-2 | 22.04-cuda12-2 | available | ubuntu |
+--------------------------------------+-----------------+----------------+-----------+--------------+
| ffb6fd93-cb06-4e8d-8058-46003b78e2ff | talos-v1.2.8 | 1.25.5 | available | talos |
+--------------------------------------+-----------------+----------------+-----------+--------------+
| 9a16a77e-1a1f-45c8-87fd-6d1a19eeaac9 | talos-v1.5.0 | 1.27.0 | available | talos |
+--------------------------------------+-----------------+----------------+-----------+--------------+
| 25fbbd96-d5ec-4d08-9c75-a5e154dabf9b | debian-11 | 11 | available | debian |
+--------------------------------------+-----------------+----------------+-----------+--------------+
| 170db96f-8458-44aa-83ca-0c31fb81a835 | rocky-9-1 | 9.1 | available | rocky |
+--------------------------------------+-----------------+----------------+-----------+--------------+
| 9b661c46-ac4f-46e1-9f3d-aaacde9b4fec | debian-9 | 9 | available | debian |
+--------------------------------------+-----------------+----------------+-----------+--------------+
卷
简介
卷是实例的灵活容量附加存储。创建卷并将其关联到实例后,该实例便可使用一个额外的虚拟磁盘来存储备份或数据库文件,之后还可以将其移至其他实例。
Kubernetes 集群的卷无需手动创建——用于 PersistentVolume 和 PersistentVolumeClaim 的集群对象会在你的账户中创建卷。
卷会占用账户配额中的磁盘空间,且只能在配额限制内创建。有关配额系统的更多信息,请参阅配额。
创建卷
你可以通过调用 civo volume create NAME SIZE(GB) 创建新卷:
Options:
-h, --help help for create
-t, --network string The network name/ID where the volume will be created (default "default")
-s, --size-gb int The new size in GB (required)
$ civo volume create CLI-demo-volume -s 25
Created a volume called CLI-demo-volume with ID 59076ec8-edba-4071-80d0-e9cfcce37b12
将卷挂载到实例
将卷挂载(附加)到实例后,该实例便可将其用作驱动器:
$ civo volume attach CLI-demo-volume api-demo.test
The volume called CLI-demo-volume with ID 59076ec8-edba-4071-80d0-e9cfcce37b12 was attached to the instance api-demo.test
如果这是新创建的卷,你需要对其进行分区、格式化和挂载。更多信息请参阅此处的 Learn 指南。 注意:一次只能将卷挂载到一个实例。
从实例分离卷
如果要将卷移至其他实例,或已不再需要使用它,可以先卸载,然后使用 civo volume detach volume_id 将其分离:
$ civo volume detach CLI-demo-volume
The volume called CLI-demo-volume with ID 59076ec8-edba-4071-80d0-e9cfcce37b12 was detached
列出卷
使用 civo volume list 可以查看卷的总体信息、大小和状态:
$ civo volume ls
+--------------------------------------+------------------------------------------+---------+----------+----------+-------+-------------+-----------+
| ID | Name | Network | Cluster | Instance | Size | Mount Point | Status |
+--------------------------------------+------------------------------------------+---------+----------+----------+-------+-------------+-----------+
| 59076ec8-edba-4071-80d0-e9cfcce37b12 | CLI-demo-volume | Default | | | 25 GB | | available |
+--------------------------------------+------------------------------------------+---------+----------+----------+-------+-------------+-----------+
当 API 报告这些信息时,列表还会显示 Delivered 列(卷当前提供的容量;调整大小期间该值会滞后于 Size,如果调整失败则保持不变)和 Resize 列(最近一次调整大小的状态;如果未完成,还会显示平台给出的原因)。
删除卷
你可以通过 civo volume delete volume_id 删除卷,以释放配额并减少账户账单。删除会立即生效:
$ civo volume delete CLI-demo-volume
The volume called CLI-demo-volume with ID 59076ec8-edba-4071-80d0-e9cfcce37b12 was deleted
如果 Kubernetes 卷的状态显示为 dangling,可以运行 civo volume delete <VOLUME-NAME> --region <REGION-NAME> 将其删除,以释放配额并避免继续产生费用。
资源快照
资源快照可用于管理资源的快照。
重要
目前,资源快照只显示实例快照。未来将支持更多资源类型。
你可以使用以下命令列出、查看详情、更新、删除和还原快照:
# List all resource snapshots
civo resource-snapshot list
# Show details of a specific snapshot
civo resource-snapshot show SNAPSHOT_ID/NAME
# Update a snapshot
civo resource-snapshot update SNAPSHOT_ID/NAME
# Delete a snapshot
civo resource-snapshot delete SNAPSHOT_ID/NAME
# Restore a snapshot
civo resource-snapshot restore SNAPSHOT_ID/NAME
列出快照时,自定义输出格式可用的字段如下:
- id
- name
- description
- resource_type
- created_at
快照计划
快照计划可自动创建和管理资源快照。
重要
目前,快照计划仅适用于实例快照。未来将支持更多资源类型。
创建计划
创建快照计划:
$ civo snapshot schedule create --name SCHEDULE_NAME --cron CRON_EXPRESSION --instance-id="INSTANCE_ID1,INSTANCE_ID2,..." --max-snapshots MAX_SNAPSHOTS [flags]
Flags:
-d, --description string Description for the snapshot schedule
-v, --include-volumes Include attached volumes in snapshots
列出计划
查看所有可用计划:
$ civo snapshot schedule list
查看计划详情
查看特定计划的详情:
$ civo snapshot schedule show SCHEDULE_NAME/ID
更新计划
更新快照计划的详情:
$ civo snapshot schedule update SCHEDULE_NAME/ID [flags]
Flags:
-d, --description string New description for the snapshot schedule
-n, --name string New name for the snapshot schedule
-p, --paused string Whether to pause the snapshot schedule (use 'true' or 'false')
示例:
$ civo snapshot schedule update my-snapshot --name new-schedule-name --description "Updated schedule description" --paused true
移除计划
删除快照计划:
$ civo snapshot schedule remove SCHEDULE_NAME/ID
团队
团队是用户的分组,每位团队成员拥有一个或多个权限(即角色)。用户登录时,无需选择要使用哪个团队,只需选择要在哪个账户下操作即可。他们可用的权限是该账户中其所属各团队权限的总和。
列出所有团队
运行 civo teams ls 即可获取所有团队的列表
$ civo teams ls
+--------------------------------------+------------------+
| ID | Name |
+--------------------------------------+------------------+
| 39a755c3-87b4-4d7b-9b05-a8dfb8672081 | Support |
| 3f233c4f-b931-44f2-9417-acf79b7f1a2d | Developers |
| 5fdff566-a77a-4343-9c41-8ad714ec8593 | Management |
| ad54-4614-8740-8604216b7ad4 | Technical Staff |
| d1bc7dd6-2930-4c8d-b9df-0b9b2bfbf68c | Site Reliability |
| e7ec2649-ad54-4614-8740-8604216b7ad4 | Owners |
+--------------------------------------+------------------+
创建新团队
要在账户中创建新团队,需要运行命令 civo teams create <NEW-TEAM-NAME>,系统将使用指定的名称创建新团队。
$ civo teams create Community
Created a team called Community with team ID 475a087b-bec8-4a66-ac14-95bc09bd8d1e
重命名团队
要重命名团队,需要运行命令 civo teams rename <OLD-TEAM-NAME> <NEW-TEAM-NAME>
$ civo teams rename Community Advocacy
The team with ID 475a087b-bec8-4a66-ac14-95bc09bd8d1e was renamed to Advocacy
删除团队
要删除团队,需要运行命令 civo teams delete <TEAM-NAME>
$ civo teams delete Advocacy
Warning: Are you sure you want to delete the Advocacy team (y/N) ? y
The team (Advocacy) has been deleted
权限
团队的每位成员都会被分配一个或多个权限(即角色)。他们可用的权限是该账户中其所属各团队权限的总和。
列出所有权限
运行命令 civo permissions ls 即可列出所有可用权限。
$ civo permissions ls
+-------------------------+----------------------------+------------------------------------------------------------------------------------------------+
| Code | Name | Description |
+-------------------------+----------------------------+------------------------------------------------------------------------------------------------+
| *.* | Owner | Can perform any action |
| organisation.owner | Organisation Owner | Can administer organisation details |
| billing.* | Billing Administrator | Can view/change billing details and see invoices |
| billing.details_viewer | Billing Details Viewer | Can view billing details |
| billing.invoices_viewer | Billing Invoices Viewer | Can view invoices |
| billing.details_changer | Billing Details Changer | Can change billing details |
| team.* | Team Administrator | Can administer teams and their members |
| team.viewer | Team Viewer | Can view existing teams and their members |
| team.creater | Team Creater | Can create new teams, as well as add/remove team members |
| team.updater | Team Updater | Can update team details, as well as add/remove team members |
| team.deleter | Team Deleter | Can remove teams (and therefore all team members) |
| kubernetes.* | Kubernetes Administrator | Can view/change Kubernetes clusters |
| kubernetes.viewer | Kubernetes Viewer | Can view existing Kubernetes clusters |
| kubernetes.creater | Kubernetes Creater | Can create new Kubernetes clusters |
| kubernetes.updater | Kubernetes Updater | Can make changes to existing Kubernetes clusters, such as scaling or marketplace installations |
| kubernetes.deleter | Kubernetes Deleter | Can delete Kubernetes clusters |
| firewall.* | Firewall Administrator | Can view/change firewalls |
| firewall.viewer | Firewall Viewer | Can view existing firewalls and their rules |
| firewall.creater | Firewall Creater | Can create new firewalls |
| firewall.updater | Firewall Updater | Can update existing firewalls and change their rules |
| firewall.deleter | Firewall Deleter | Can delete firewalls |
| compute.* | Compute Administrator | Can view/change Compute instances |
| compute.viewer | Compute Viewer | Can view existing Compute instances |
| compute.creater | Compute Creater | Can create new Compute instances |
| compute.updater | Compute Updater | Can update (e.g. scale, rename) existing Compute instances |
| compute.deleter | Compute Deleter | Can delete Compute instances |
| loadbalancer.* | Loadbalancer Administrator | Can view/change Loadbalancers |
| loadbalancer.viewer | Loadbalancer Viewer | Can view existing Loadbalancers |
| loadbalancer.creater | Loadbalancer Creater | Can create new Loadbalancers |
| loadbalancer.updater | Loadbalancer Updater | Can update (e.g. scale, rename) existing Loadbalancers |
| loadbalancer.deleter | Loadbalancer Deleter | Can delete Loadbalancers |
| dns.* | DNS Administrator | Can view/change DNS domain names and records |
| dns.viewer | DNS Viewer | Can view existing DNS domain names and records |
| dns.creater | DNS Creater | Can create new DNS domain names and records |
| dns.updater | DNS Updater | Can update existing DNS domain names and records |
| dns.deleter | DNS Deleter | Can delete DNS domain names and records |
| network.* | Network Administrator | Can view/change networks |
| network.viewer | Network Viewer | Can view existing networks |
| network.creater | Network Creater | Can create new networks |
| network.updater | Network Updater | Can rename existing networks |
| network.deleter | Network Deleter | Can delete networks |
| quota.manager | Quota Manager | Can request changes to the account quota |
| volume.* | Volume Administrator | Can view/change volumes |
| volume.viewer | Volume Viewer | Can view volumes |
| volume.creater | Volume Creater | Can create new volumes |
| volume.updater | Volume Updater | Can change existing volumes (e.g. manage attachments) |
| volume.deleter | Volume Deleter | Can delete volumes |
| sshkey.* | SSH Keys Administrator | Can view/change SSH keys |
| sshkey.viewer | SSH Keys Viewer | Can view existing SSH keys |
| sshkey.creater | SSH Keys Creater | Can upload new SSH keys |
| sshkey.updater | SSH Keys Updater | Can change existing SSH keys |
| sshkey.deleter | SSH Keys Deleter | Can delete SSH keys |
| webhook.* | Webhook Administrator | Can view/change webhooks |
| webhook.viewer | Webhook Viewer | Can view existing webhooks |
| webhook.creater | Webhook Creater | Can create new webhooks |
| webhook.updater | Webhook Updater | Can change existing webhooks |
| webhook.deleter | Webhook Deleter | Can delete webhooks |
+-------------------------+----------------------------+------------------------------------------------------------------------------------------------+
区域
随着 Civo 的发展,实例可用的区域也会不断增加。运行 civo region ls 即可列出可用区域。块存储(卷)按区域划分,因此,如果在某个区域中配置了实例,要连接到该实例的所有卷都必须位于同一区域。
列出所有区域
运行 civo region ls 即可获取所有区域的列表
civo region ls
+--------+--------+----------------+---------+
| Code | Name | Country | Current |
+--------+--------+----------------+---------+
| nyc1 | nyc1 | United States | |
+--------+--------+----------------+---------+
| phx1 | phx1 | United States | |
+--------+--------+----------------+---------+
| dg-exm | dg-exm | United Kingdom | |
+--------+--------+----------------+---------+
| fra1 | fra1 | Germany | |
+--------+--------+----------------+---------+
| lon1 | lon1 | United Kingdom | <===== |
+--------+--------+----------------+---------+
更改区域
要更改区域,只需运行命令 civo region current <REGION-CODE>,你会看到类似这样的消息:
civo region current NYC1
默认区域已设置为 (New York 1) NYC1
在非交互模式下使用区域
要在非交互模式下设置区域,只需像这样向命令传入 --region <REGION-CODE>
civo kubernetes create production-01 -n 4 --wait --region NYC1
启用 Shell 自动补全
civo 二进制文件支持 bash、zsh、powershell 和 fish,你可以按以下方式使用:
civo completion [bash|zsh|powershell|fish]
在 Shell 中加载补全脚本即可启用 civo 自动补全。
不过,补全脚本依赖 bash-completion,因此你必须先安装该软件(运行 type _init_completion 可以检查是否已安装 bash-completion)。
安装 bash-completion
许多包管理器都提供 bash-completion(参见此处)。你可以使用 apt-get install bash-completion 或 yum install bash-completion 等命令安装。
上述命令会创建 /usr/share/bash-completion/bash_completion,这是 bash-completion 的主脚本。根据你使用的包管理器,你可能需要手动在 ~/.bashrc 文件中加载此文件。
要进行检查,请重新加载 Shell 并运行 type _init_completion。如果命令执行成功,说明已设置完毕;否则,请将以下内容添加到 ~/.bashrc 文件中:
source /usr/share/bash-completion/bash_completion
重新加载 Shell,然后输入 type _init_completion,验证 bash-completion 是否已正确安装。
启用 civo 自动补全
现在,你需要确保 civo 补全脚本在所有 Shell 会话中都能加载。你可以通过以下两种方式实现:
-
在
~/.bashrc文件中加载补全脚本:echo 'source <(civo completion bash)' >>~/.bashrc -
将补全脚本添加到
/etc/bash_completion.d目录:civo completion bash >/etc/bash_completion.d/civo
如果为 civo 设置了别名,你可以扩展 Shell 补全功能,使其也适用于该别名:
echo 'alias c=civo' >>~/.bashrc
echo 'complete -F __start_civo c' >>~/.bashrc
安装 zsh-completion
可以使用命令 civo completion zsh 生成 civo 的 Zsh 补全脚本。在 shell 中加载补全脚本即可启用 civo 自动补全。
要在所有 shell 会话中启用,请将以下内容添加到 ~/.zshrc 文件中:
source <(civo completion zsh)
如果你为 civo 设置了别名,可以扩展 shell 补全,使其支持该别名:
echo 'alias c=civo' >>~/.zshrc
echo 'complete -F __start_civo c' >>~/.zshrc
重新加载 shell 后,civo 自动补全应该就可以正常使用了。
如果出现类似 complete:13: command not found: compdef 的错误,请将以下内容添加到 ~/.zshrc 文件开头:
autoload -Uz compinit
compinit
若要设置 zsh 的 civo 补全代码,使其在启动时自动加载,可以运行以下命令。
civo completion zsh > "${fpath[1]}/_civo"
参与贡献
欢迎在 GitHub 上提交 Bug 报告和拉取请求:https://github.com/civo/cli。
许可证
本代码以开源形式提供,遵循 Apache License 2.0 的条款。