更新easzctl 帮助信息和部分文档

pull/531/head
gjmzj 2019-02-26 15:04:16 +08:00
parent 4c6ec53cda
commit 5a9af26bf9
6 changed files with 49 additions and 18 deletions

View File

@ -1,4 +1,4 @@
# kubeasz
# kubeasz - Ansible Spirit Zone In Kubernetes
`kubeasz`致力于提供快速部署高可用`k8s`集群的工具, 并且也努力成为`k8s`实践、使用的参考书;基于二进制方式部署和利用`ansible-playbook`实现自动化:即提供一键安装脚本, 也可以分步执行安装各个组件, 同时讲解每一步主要参数配置和注意事项。
@ -56,7 +56,7 @@
<td><a href="docs/op/AddNode.md">增加node节点</a></td>
<td><a href="docs/op/AddMaster.md">增加master节点</a></td>
<td><a href="docs/op/op-etcd.md">管理etcd集群</a></td>
<td><a href="docs/op/del_one_node.md">删除节点</a></td>
<td><a href="docs/op/clean_one_node.md">删除节点</a></td>
<td><a href="docs/op/upgrade.md">升级集群</a></td>
<td><a href="docs/op/cluster_restore.md">备份恢复</a></td>
</tr>

View File

@ -6,7 +6,7 @@
- [升级 K8S 版本](upgrade.md)
- [修改多主集群VIP地址](ChangeVIP.md)
- [修改AIO部署的系统IP](change_ip_allinone.md)
- [集群删除单个节点](del_one_node.md)
- [集群删除单个节点](clean_one_node.md)
- [替换集群使用的网络插件](change_k8s_network.md)
- [集群备份与恢复](cluster_restore.md)
- [设置只读权限 kubeconfig](readonly_kubectl.md)

View File

@ -21,6 +21,9 @@
- cfssl-certinfo
- cfssljson
- name: 分发 easzctl 工具
copy: src={{ base_dir }}/tools/easzctl dest={{ bin_dir }}/easzctl mode=0755
- name: 写入环境变量$PATH
lineinfile:
dest: ~/.bashrc

View File

@ -1,4 +1,4 @@
# 警告此脚本将清理单个node节点使用请详细参阅 docs/op/del_one_node.md
# 警告此脚本将清理单个node节点使用请详细参阅 docs/op/clean_one_node.md
# 请三思后运行此脚本特别的如果有pod使用了本地存储类型请自行判断重要性
# 使用:
# 1. 执行 ansible-playbook /etc/ansible/tools/clean_one_node.yml

View File

@ -8,7 +8,7 @@ set -o nounset
function usage() {
cat <<EOF
Usage: easzctl COMMAND [args]
Usage: easzctl COMMAND <args>
Commands:
add-node To add a kube-node(work node) to the k8s cluster
add-master To add a kube-master(master node) to the k8s cluster
@ -22,7 +22,7 @@ EOF
}
function process_cmd() {
echo -e "$ACTION : $CMD"
echo -e "+---\033[33m$ACTION\033[0m---+ : $CMD"
$CMD || { echo -e "+---\033[31mAction failed\033[0m---+ : $CMD"; exit 1; }
echo -e "+---\033[32mAction successed\033[0m---+ : $CMD"
}
@ -93,6 +93,30 @@ function clean-node() {
ansible-playbook $BASEPATH/tools/clean_one_node.yml -e NODE_TO_DEL=$1
}
function help-info() {
case "$1" in
(add-node)
echo -e "Usage: easzctl add-node <new_node_ip>\n\nMore information please refer to 'docs/op/AddNode.md'"
;;
(add-master)
echo -e "Usage: easzctl add-master <new_master_ip>\n\nMore information please refer to 'docs/op/AddMaster.md'"
;;
(add-etcd)
echo -e "Usage: easzctl add-etcd <new_etcd_ip>\n\nMore information please refer to 'docs/op/op-etcd.md'"
;;
(del-etcd)
echo -e "Usage: easzctl del-etcd <etcd_ip>\n\nMore information please refer to 'docs/op/op-etcd.md'"
;;
(clean-node)
echo -e "Usage: easzctl clean-node <node_ip>\n\nMore information please refer to 'docs/op/clean_one_node.md'"
;;
(*)
usage
exit 0
;;
esac
}
###############################################################
BASEPATH=/etc/ansible
@ -100,28 +124,32 @@ BASEPATH=/etc/ansible
[ "$#" -gt 1 ] || { usage >&2; exit 2; }
case "$1" in
(add-node)
ACTION="+---\033[33mAction: add a k8s work node\033[0m---+"
(add-node)
ACTION="Action: add a k8s work node"
CMD="add-node $2"
;;
(add-master)
ACTION="+---\033[33mAction: add a k8s master node\033[0m---+"
(add-master)
ACTION="Action: add a k8s master node"
CMD="add-master $2"
;;
(add-etcd)
ACTION="+---\033[33mAction: add a etcd node\033[0m---+"
(add-etcd)
ACTION="Action: add a etcd node"
CMD="add-etcd $2"
;;
(del-etcd)
ACTION="+---\033[33mAction: delete a etcd node\033[0m---+"
(del-etcd)
ACTION="Action: delete a etcd node"
CMD="del-etcd $2"
;;
(clean-node)
ACTION="+---\033[33mAction: clean a node\033[0m---+"
(clean-node)
ACTION="Action: clean a node"
CMD="clean-node $2"
;;
(*)
(help)
help-info $2
exit 0
;;
(*)
usage
exit 0
;;