Helm/Prometheus

From Chorke Wiki
Jump to navigation Jump to search
helm repo add prometheus https://prometheus-community.github.io/helm-charts
helm repo update
helm repo list

Config

export KUBECONFIG="${HOME}/.kube/dev-kubeconfig.yaml"
export KUBECONFIG="${HOME}/.kube/gcp-kubeconfig.yaml"
export KUBECONFIG="${HOME}/.kube/config"

Install

kubectl create namespace prometheus
helm show values prometheus/prometheus
cat <<YML | helm install -n prometheus prometheus prometheus/prometheus -f -
server:
  ingress:
    enabled: true
    hosts:
    - prometheus.k8s.local
YML

Uninstall

helm uninstall -n prometheus prometheus
helm delete    -n prometheus prometheus

Playground

helm upgrade --install -f values.yaml prometheus prometheus/prometheus
helm upgrade --install prometheus prometheus/prometheus
helm show values prometheus/prometheus
kubectl exec -n prometheus -it prometheus-6fd8886fd4-4vwgh -- cat /etc/os-release
kubectl exec -n prometheus -it prometheus-6fd8886fd4-4vwgh -- bash
kubectl exec -n prometheus -it prometheus-6fd8886fd4-4vwgh -- sh

kubectl delete all --all -n prometheus
kubectl delete ing --all -n prometheus
kubectl delete sts --all -n prometheus
kubectl delete svc --all -n prometheus
kubectl delete pvc --all -n prometheus
kubectl delete pv  --all -n prometheus

kubectl logs -f prometheus-6fd8886fd4-4vwgh -n prometheus
kubectl rollout restart deploy prometheus -n prometheus
kubectl rollout restart sts prometheus -n prometheus
kubectl logs -f prometheus-hash -n prometheus
kubectl config --kubeconfig=${HOME}/.kube/aws-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/dev-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/gcp-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/config view --flatten

kubectl get secret -n prometheus prometheus -o json|jq -r '.data."admin-password"'|base64 -d;echo
kubectl get secret -n prometheus prometheus -o json|jq -r '.data."admin-user"'|base64 -d;echo

References