Skip to content

Instantly share code, notes, and snippets.

@todd-dsm
Created August 22, 2024 18:37
Show Gist options
  • Save todd-dsm/13965172439ffecc1998c05df3efd38a to your computer and use it in GitHub Desktop.
Save todd-dsm/13965172439ffecc1998c05df3efd38a to your computer and use it in GitHub Desktop.
install kube-prometheus-stack on minikube via helm
###----------------------------------------------------------------------------
### MAIN PROGRAM
###----------------------------------------------------------------------------
### PREP
###---
###---
### The kube-prometheus stack includes a resource metrics API server, so the
### metrics-server addon is unnecessary.
###---
pMsg "Disabling the metrics-server, it's unnecessary with Prometheus..."
minikube addons disable metrics-server
###---
### Install
### * kube-prometheus-stack-operator
### * kube-state-metrics
### * prometheus-node-exporter
### REF: github|kube-prometheus-stack | https://bit.ly/4cx7Byw
###---
pMsg "Deploying the kube-prometheus-stack..."
helm upgrade --install "$kpsRelName" prometheus-community/kube-prometheus-stack \
--namespace "$kpsNameSpace" --create-namespace --timeout=120s
###---
### Wait for it...
###---
pMsg "Waiting for pods to go Ready..."
kubectl --namespace="$kpsNameSpace" wait --for condition=Ready pod \
-l release="$kpsRelName"
kubectl --namespace="$kpsNameSpace" wait --for condition=Ready pod \
-l app.kubernetes.io/instance=${kpsRelName}-kube-prometheus-stack-prometheus
###----------------------------------------------------------------------------
### Expose the services
###----------------------------------------------------------------------------
### Expose Grafana via LoadBalancer
###---
kubectl -n monitoring expose deployment "${kpsRelName}-grafana" \
--type=LoadBalancer --port=3000 --name grafana
###---
### Expose Prometheus via LoadBalancer
###---
kubectl -n monitoring expose service "${kpsRelName}-kube-prometheus-stack-prometheus" \
--type=LoadBalancer --port=9090 --name prometheus
@todd-dsm
Copy link
Author

Learning Material

install and basic config

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