The $KUBECONFIG variable is like $PATH, and supports multiple files separated by `:`, but --kubeconfig only takes a single file as a value. Since kubectl picks up the $KUBECONFIG variable already, don't pass it to kubectl. Also, use --namespace instead of -n to support older kubectl versions.
24 lines
490 B
Bash
Executable File
24 lines
490 B
Bash
Executable File
#!/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/exporters
|
|
kctl delete -f manifests/grafana
|
|
kctl delete -f manifests/prometheus
|
|
kctl delete -f manifests/alertmanager
|
|
|
|
# Hack: wait a bit to let the controller delete the deployed Prometheus server.
|
|
sleep 5
|
|
|
|
kctl delete -f manifests/prometheus-operator.yaml
|