forked from camilb/prometheus-kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
teardown
executable file
·36 lines (25 loc) · 1004 Bytes
/
teardown
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
if [ -z "${KUBECONFIG}" ]; then
export KUBECONFIG=~/.kube/config
fi
if [ -z "${NAMESPACE}" ]; then
NAMESPACE=monitoring
fi
kctl() {
kubectl --namespace "$NAMESPACE" "$@"
}
kctl delete -f manifests/node-exporter
kctl delete -f manifests/kube-state-metrics
kctl delete -f manifests/grafana
find manifests/prometheus -type f ! -name prometheus-k8s-rbac.yaml -exec kubectl --namespace "$NAMESPACE" delete -f {} \;
kubectl delete -f manifests/prometheus/prometheus-k8s-rbac.yaml
kctl delete -f manifests/alertmanager
kubectl delete -f manifests/k8s/self-hosted
# Hack: wait a bit to let the controller delete the deployed Prometheus server.
sleep 5
kctl delete -f manifests/prometheus-operator
kctl delete secret grafana-credentials
kctl delete svc alertmanager-operated
kctl delete svc prometheus-operated
#delete created custom resource definitions
kubectl get crd -o 'jsonpath={.items[*].metadata.name}' | xargs -n 1 | fgrep coreos.com | xargs kubectl delete crd