Local development environment for minikube running JupyterHub, Prometheus and Grafana.
- Check minikube context
kubectl config current-context
minikube start \
--kubernetes-version stable \
--nodes 2 \
--cpus 2 \
--memory 2000 \
--cni calico
To test that the cluster is running, run:
kubectl get node
- Get the JupyterHub helm chart
helm repo add jupyterhub https://hub.jupyter.org/helm-chart/
helm repo update
- Get the Prometheus helm chart
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
- Get the Grafana helm chart
helm repo add grafana https://grafana.github.io/helm-charts
helm repo update
- Fetch chart dependencies
helm dep build ./helm-charts/<app/support>
- Install the charts and deploy
python3 deployer.py <app/support> --namespace=<app/support>
When using helm
commands, remember to include the namespace flags
helm list --all-namespaces
helm -n support uninstall test-release
-
Temporarily save the Grafana token in a file called
grafana-token.secret.yaml
-
Use age to generate a key with
age-keygen -o key.secret.txt
- Encrypt
grafana-token.secret.yaml
with the key
sops encrypt --age <age-public-key> grafana-token.secret.yaml > enc-grafana-token.secret.yaml
This can be checked into version control.
- You can decrypt
enc-grafana-token.secret.yaml
by setting the environment variableSOPS_AGE_KEY="<age-secret-key>"
and using the command
sops decrypt enc-grafana-token.secret.yaml
Ensure that you have set the environment variable SOPS_AGE_KEY
to the age secret key in order to decrypt the Grafana token.
python3 deployer.py grafana
The deployer script assumes that the Grafana dashboards are served at http://localhost:3000.
kubectl port-forward -n app service/proxy-public 8080:http
then visit http://localhost:8080
kubectl port-forward -n support service/support-prometheus-server 9090:80
then visit http://localhost:9090
kubectl port-forward -n support service/support-grafana 3000:80
then visit http://localhost:3000
The single user server pods will spin up in the same namespace as above
$ k -n support get pod
NAME READY STATUS RESTARTS AGE
hub-5847b8cfdc-46mn9 1/1 Running 0 12m
jupyter-jnywong 1/1 Running 0 105s
proxy-74f5974f66-c2wrk 1/1 Running 0 12m
user-scheduler-6c77bd4657-79dnz 1/1 Running 0 12m
user-scheduler-6c77bd4657-zjvmm 1/1 Running 0 12m
When you are done, you can uninstall the chart and delete the minikube cluster.
helm -n support uninstall support
helm -n app uninstall app
minikube stop