CMD=$1

showHelp(){
	echo "start  ---- start k8s cluster"
}

executeCommand(){
	echo "---------- $CMD etcd --------"
	systemctl $CMD etcd
	echo "---------- $CMD: docker --------"
	systemctl $CMD docker
	echo "---------- $CMD: kube-apiserver --------"
	systemctl $CMD kube-apiserver
	echo "---------- $CMD: kube-controller-manager --------"
	systemctl $CMD kube-controller-manager
	echo "---------- $CMD: kube-scheduler --------"
	systemctl $CMD kube-scheduler
	echo "---------- $CMD: kubelet--------"
	systemctl $CMD kubelet
	echo "---------- $CMD: kube-proxy--------"
	systemctl $CMD kube-proxy
}

showGift(){
	echo " ___                     ___              
     /  /\      ___          /  /\             
    /  /:/_    /  /\        /  /:/_            
   /  /:/ /\  /  /:/       /  /:/ /\           
  /  /:/ /:/ /__/::\      /  /:/ /::\          
 /__/:/ /:/  \__\/\:\__  /__/:/ /:/\:\         
 \  \:\/:/      \  \:\/\ \  \:\/:/~/:/         
  \  \::/        \__\::/  \  \::/ /:/          
   \  \:\        /__/:/    \__\/ /:/           
    \  \:\       \__\/       /__/:/            
     \__\/                   \__\/  "
}

if [ -z $CMD ]
then
	echo "The input parameter is null"
	showHelp
	exit 1
fi
if [ "$CMD" != "start" ] && [ "$CMD" != "stop" ] && [ "$CMD" != "status" ]
then
	echo "Parameter not valid"
	showHelp
	exit 1
fi
showGift
executeCommand

 

转载于:https://my.oschina.net/mrpei123/blog/3019923

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐