-
Notifications
You must be signed in to change notification settings - Fork 0
/
dashboard.sh
executable file
·54 lines (49 loc) · 2.57 KB
/
dashboard.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
function title() {
echo
echo "##############################################################################"
echo "# $1"
echo "##############################################################################"
}
if [ "$1" == "install" ]; then
title "Install dashboard in namespace kubernetes-dashboard"
./kubectl_wrapper.sh create namespace kubernetes-dashboard
./helm_wrapper.sh repo add kubernetes-dashboard https://kubernetes.github.io/dashboard/
./helm_wrapper.sh repo update
./helm_wrapper.sh upgrade --install kubernetes-dashboard \
--set metricsScraper.enabled=true \
--set nodeSelector.node-type=control-node \
--set 'tolerations[0].effect=NoSchedule' \
--set 'tolerations[0].key=node-role.kubernetes.io/master' \
--set 'tolerations[0].operator=Exists' \
--set 'tolerations[1].effect=NoSchedule' \
--set 'tolerations[1].key=node-role.kubernetes.io/control-plane' \
--set 'tolerations[1].operator=Exists' \
--namespace kubernetes-dashboard \
kubernetes-dashboard/kubernetes-dashboard \
--version 6.0.8
title "Install dashboard admin user"
./kubectl_wrapper.sh apply -f dashboard-user-admin.yaml
./kubectl_wrapper.sh wait --namespace kubernetes-dashboard \
--for=condition=ready pod \
--selector=app.kubernetes.io/name=kubernetes-dashboard \
--timeout=90s
elif [ "$1" == "uninstall" ]; then
title "Uninstall dashboard and namespace kubernetes-dashboard"
./helm_wrapper.sh uninstall kubernetes-dashboard --namespace kubernetes-dashboard
./kubectl_wrapper.sh delete namespace kubernetes-dashboard
elif [ "$1" == "proxy" ]; then
title "Dashboard token:"
./kubectl_wrapper.sh wait --namespace kubernetes-dashboard \
--for=condition=ready pod \
--selector=app.kubernetes.io/name=kubernetes-dashboard \
--timeout=90s
./kubectl_wrapper.sh -n kubernetes-dashboard create token admin-user
title "Proxy link: (ctrl + c to quit): https://127.0.0.1:10443"
./kubectl_wrapper.sh port-forward -n kubernetes-dashboard service/kubernetes-dashboard 10443:443
else
echo "Need either install, uninstall or proxy as parameter. Got \"$1\""
echo
echo "$0 install|uninstall|proxy"
exit 1
fi