Getting started(准备)
The CLI client needs to know the StorageOS server address, username and password. Configuration is supplied throughenvironment variables:
## 添加环境变量 # export STORAGEOS_HOST=<ip_address:port> # export STORAGEOS_USERNAME=<your username> # export STORAGEOS_PASSWORD=<your password> # export STORAGEOS_DISCOVERY=<ip_address> # Optional - only when not using the default discovery service. [root@ec-k8s-m1 ~]# kubectl get svc --namespace storageos NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE storageos ClusterIP 10.101.18.80 <none> 5705/TCP 5 minutes [root@ec-k8s-m1 ~]# vim /etc/profile export STORAGEOS_HOST=10.101.18.80:5705 export STORAGEOS_USERNAME=storageos export STORAGEOS_PASSWORD=storageos [root@ec-k8s-m1 ~]# source /etc/profile
Binary Installation (Linux)(安装)
## https://github.com/storageos/go-cli/releases # [root@ec-k8s-m1 ~]# curl -skSL https://github.com/storageos/go-cli/releases/download/1.0.0-rc3/storageos_linux_amd64 > /usr/local/bin/storageos [root@ec-k8s-m1 ~]# chmod +x /usr/local/bin/storageos
## install-bash-completion 安装“命令自动补全” # [root@ec-k8s-m1 storageos]# storageos install-bash-completion
Docker
## We recommend that you create a bash alias for the docker run command: ## 推荐创建一个bash别名使用 docker run 命令 # alias storageos='docker run --rm -e STORAGEOS_HOST -e STORAGEOS_USERNAME -e STORAGEOS_PASSWORD storageos/cli'
Usage(运用)
## storageos COMMAND SubCommand ## 查看集群健康状态 # [root@ec-k8s-m1 storageos]# storageos cluster health NODE ADDRESS CP_STATUS DP_STATUS ec-k8s-n1 172.16.0.61 Healthy Healthy ec-k8s-n2 172.16.0.62 Healthy Healthy ec-k8s-n3 172.16.0.63 Healthy Healthy ec-nfs01 172.16.0.31 Healthy Healthy
## 查看节点状态 # [root@ec-k8s-m1 storageos]# storageos node ls NAME ADDRESS HEALTH SCHEDULER VOLUMES TOTAL USED VERSION ec-k8s-n1 172.16.0.61 Healthy 8 minutes true M: 0, R: 0 39.66GB 10.55% 1.0.0 ec-k8s-n2 172.16.0.62 Healthy 8 minutes false M: 0, R: 0 39.66GB 20.51% 1.0.0 ec-k8s-n3 172.16.0.63 Healthy 8 minutes false M: 0, R: 0 39.66GB 16.46% 1.0.0 ec-nfs01 172.16.0.31 Healthy 8 minutes false M: 0, R: 0 39.66GB 14.70% 1.0.0
Run storageos to get usage information.
运行storageos命令,以获得使用说明
Management Commands:
cluster Manage clusters
licence Manage the licence
logs View and manage node logs on the active cluster
namespace Manage namespaces
node Manage nodes
policy Manage policies
pool Manage capacity pools
rule Manage rules
user Manage users
volume Manage volumes
Command | Subcommand | Description |
---|---|---|
cluster | create health inspect rm | Cluster information. |
logs | view | View and manage node logs. |
login | Store login credentials for a given StorageOS host. | |
logout | Delete stored login credentials for a given StorageOS host. | |
namespace | create inspect ls rm update | Namespaces help different projects or teams organize volumes. |
node | cordon drain health inspect ls uncordon undrain update | Node information. |
policy | create inspect ls rm | Define how resources are accessed by users and groups. |
pool | create inspect ls rm | A collection of storage resources for provisioning volumes. |
rule | create inspect ls rm update | Rules define label-based policies to apply to volumes. |
user | create inspect ls rm update | User and group management. |
version | Display the version. | |
volume | create inspect ls rm update | StorageOS data volumes. |
参考资料:
https://github.com/storageos/go-cli
相关链接:
Helm Install StorageOS on a Kubernetes Cluster