diff --git a/README.md b/README.md
index 46ab882..af18cfa 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# kubeasz
+# kubeasz - Ansible Spirit Zone In Kubernetes
`kubeasz`致力于提供快速部署高可用`k8s`集群的工具, 并且也努力成为`k8s`实践、使用的参考书;基于二进制方式部署和利用`ansible-playbook`实现自动化:即提供一键安装脚本, 也可以分步执行安装各个组件, 同时讲解每一步主要参数配置和注意事项。
@@ -56,7 +56,7 @@
增加node节点 |
增加master节点 |
管理etcd集群 |
- 删除节点 |
+ 删除节点 |
升级集群 |
备份恢复 |
diff --git a/docs/op/del_one_node.md b/docs/op/clean_one_node.md
similarity index 100%
rename from docs/op/del_one_node.md
rename to docs/op/clean_one_node.md
diff --git a/docs/op/op-index.md b/docs/op/op-index.md
index b0095bb..dce778e 100644
--- a/docs/op/op-index.md
+++ b/docs/op/op-index.md
@@ -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)
diff --git a/roles/prepare/tasks/main.yml b/roles/prepare/tasks/main.yml
index 93acc25..99937bd 100644
--- a/roles/prepare/tasks/main.yml
+++ b/roles/prepare/tasks/main.yml
@@ -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
diff --git a/tools/clean_one_node.yml b/tools/clean_one_node.yml
index 8a1f41c..3099e3b 100644
--- a/tools/clean_one_node.yml
+++ b/tools/clean_one_node.yml
@@ -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
diff --git a/tools/easzctl b/tools/easzctl
index 55adc92..af282b8 100755
--- a/tools/easzctl
+++ b/tools/easzctl
@@ -8,7 +8,7 @@ set -o nounset
function usage() {
cat <
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 \n\nMore information please refer to 'docs/op/AddNode.md'"
+ ;;
+ (add-master)
+ echo -e "Usage: easzctl add-master \n\nMore information please refer to 'docs/op/AddMaster.md'"
+ ;;
+ (add-etcd)
+ echo -e "Usage: easzctl add-etcd \n\nMore information please refer to 'docs/op/op-etcd.md'"
+ ;;
+ (del-etcd)
+ echo -e "Usage: easzctl del-etcd \n\nMore information please refer to 'docs/op/op-etcd.md'"
+ ;;
+ (clean-node)
+ echo -e "Usage: easzctl clean-node \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
;;