From 4105f08935ad7c30ae35b05b52728093db113da9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torma=20Krist=C3=B3f?= Date: Mon, 18 Mar 2019 23:41:25 +0100 Subject: [PATCH] Create kubernetes_dashboard_setup.sh --- deploy/kubernetes_dashboard_setup.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 deploy/kubernetes_dashboard_setup.sh diff --git a/deploy/kubernetes_dashboard_setup.sh b/deploy/kubernetes_dashboard_setup.sh new file mode 100644 index 0000000..4f92455 --- /dev/null +++ b/deploy/kubernetes_dashboard_setup.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +#Gen certificates +mkdir -p certs +cd certs +CERT_DIR=$PWD +openssl genrsa -des3 -passout pass:x -out dashboard.pass.key 2048 +openssl rsa -passin pass:x -in dashboard.pass.key -out dashboard.key +rm dashboard.pass.key +openssl req -new -key dashboard.key -out dashboard.csr -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" +openssl x509 -req -sha256 -days 365 -in dashboard.csr -signkey dashboard.key -out dashboard.crt +kubectl create secret generic kubernetes-dashboard-certs --from-file=$CERT_DIR -n kube-system +cd .. + +#Deploy the dashboard +#wget https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml +wget https://raw.githubusercontent.com/kubernetes/dashboard/master/aio/deploy/recommended/kubernetes-dashboard.yaml +sed -i '176i\ type: LoadBalancer' kubernetes-dashboard.yaml +kubectl apply -f kubernetes-dashboard.yaml + +#Token based dashboard authentication +kubectl create serviceaccount k8sadmin -n kube-system +kubectl create clusterrolebinding k8sadmin --clusterrole=cluster-admin --serviceaccount=kube-system:k8sadmin