Skip to content

Instantly share code, notes, and snippets.

@barakm
Last active July 20, 2020 13:54
Show Gist options
  • Save barakm/e7ad4c6d3aa7a80152658eda36819d95 to your computer and use it in GitHub Desktop.
Save barakm/e7ad4c6d3aa7a80152658eda36819d95 to your computer and use it in GitHub Desktop.
#/bin/bash
# script to set up a Kind Kubernetes on local machine, configured with no authentication and dashboard with TLS disabled.
# Download this script to an empty directory, and execute with
#
# chmod +x kind_always_allow_with_dashboard.sh; ./kind_always_allow_with_dashboard.sh
echo Installing components
brew install kind kubectl helm
helm repo add kubernetes-dashboard https://kubernetes.github.io/dashboard/
echo Downloading configuration file
wget https://gist.githubusercontent.com/barakm/c6bfcf3b3d168f2d0766497a07c5e046/raw/7c046fa40c8bf46dff30a8bedb01965bff8c8416/kind-config-always-allow.yaml
echo Creating cluster
kind create cluster --config kind-config-always-allow.yaml
echo installing dashboard
helm install dashboard kubernetes-dashboard/kubernetes-dashboard --set protocolHttp=true --wait
echo Waiting for pods to finish startup
while [ `kubectl get pods | grep -c Running ` = 0 ]; do
sleep 5
done
export POD_NAME=$(kubectl get pods -n default -l "app.kubernetes.io/name=kubernetes-dashboard,app.kubernetes.io/instance=dashboard" -o jsonpath="{.items[0].metadata.name}")
echo Dashboard is available at: http://localhost:9090
kubectl -n default port-forward $POD_NAME 9090:9090
@barakm
Copy link
Author

barakm commented Jul 20, 2020

The --wait flag on helm install is problematic due to helm/helm#3173 - so added the kubectl|grep loop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment