# Install the Helm repo with:

helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update

# Get values and modify to fit your setup:

helm show values prometheus-community/kube-prometheus-stack > values.yaml

# Then install (in this case in the "monitoring" namespace):

helm install -f values.yaml kube-prometheus-stack prometheus-community/kube-prometheus-stack -n monitoring

# If you need to change stuff after, edit the "values.yaml" file and upgrade the deployment with it:

helm upgrade -n monitoring kube-prometheus-stack prometheus-community/kube-prometheus-stack -f values.yaml 

# Then create the service to access Grafana:

cat <<EOF > grafana.service.yaml

apiVersion: v1
kind: Service
metadata:
  name: kube-monitoring-stack-grafana
  namespace: monitoring
spec:
  selector:
    app.kubernetes.io/instance: kube-prometheus-stack
    app.kubernetes.io/name: grafana
  ports:
    - protocol: TCP
      port: 1080
      targetPort: 3000
EOF

kubectl apply -f grafana.service.yaml
