sh kubernetes仪表板外壳

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh kubernetes仪表板外壳相关的知识,希望对你有一定的参考价值。

#!/bin/sh

PORT_PROG_KILL="kill $(lsof -i:8001 | grep kubectl | cut -c 9-16 | uniq);"
PRAM=$1

if [ "$PRAM" = "" ]; then
  echo "パラメータが何も入力されませんでした。"
  exit -1
elif [ "$PRAM" = "c" ]; then
  CMD="kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.8.1/src/deploy/recommended/kubernetes-dashboard.yaml --record"
elif [ "$PRAM" = "d" ]; then
  CMD="kubectl delete -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.8.1/src/deploy/recommended/kubernetes-dashboard.yaml; $PORT_PROG_KILL"
elif [ "$PRAM" = "a" ]; then
  CMD="kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.8.1/src/deploy/recommended/kubernetes-dashboard.yaml"
elif [ "$PRAM" = "g" ]; then
  CMD="kubectl get deployments,replicasets,pods,service --all-namespaces -o wide --selector=k8s-app=kubernetes-dashboard"
elif [ "$PRAM" = "h" ]; then
  CMD="kubectl rollout history deployment kubernetes-dashboard"
elif [ "$PRAM" = "r" ]; then
  CMD="kubectl rollout undo deployment kubernetes-dashboard"
elif [ "$PRAM" = "p" ]; then
  CMD="$PORT_PROG_KILL kubectl proxy &"
elif [ "$PRAM" = "o" ]; then
  CMD="open http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/"
else
  echo "不正なパラメータ: $PRAM"
  exit -1
fi

echo $CMD
eval $CMD

exit 0

以上是关于sh kubernetes仪表板外壳的主要内容,如果未能解决你的问题,请参考以下文章

sh 简单的Kubernetes仪表板管理,用于本地开发

Kubernetes - 登录到 Kubernetes 仪表板问题

sh 查看外壳文件具体的执行

sh 外壳:杀

sh 外壳启动蟒蛇

sh 外壳为の文