mirror of
https://github.com/prometheus-operator/kube-prometheus.git
synced 2025-08-28 09:52:17 +02:00
There is an issue with kubectl apply and third party resources, so for the time being we use create for TPRs, but apply for all manifests that it can handle.
40 lines
1.1 KiB
Bash
Executable File
40 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
if [ -z "${KUBECONFIG}" ]; then
|
|
export KUBECONFIG=~/.kube/config
|
|
fi
|
|
|
|
if [ -z "${NAMESPACE}" ]; then
|
|
NAMESPACE=monitoring
|
|
fi
|
|
|
|
kubectl create namespace "$NAMESPACE"
|
|
|
|
kctl() {
|
|
kubectl --namespace "$NAMESPACE" "$@"
|
|
}
|
|
|
|
kctl apply -f manifests/prometheus-operator.yaml
|
|
|
|
# Wait for TPRs to be ready.
|
|
until kctl get servicemonitor; do sleep 1; done
|
|
until kctl get prometheus; do sleep 1; done
|
|
until kctl get alertmanager; do sleep 1; done
|
|
|
|
kctl apply -f manifests/exporters
|
|
kctl apply -f manifests/grafana
|
|
|
|
kctl apply -f manifests/prometheus/prometheus-k8s-cm.yaml
|
|
kctl apply -f manifests/prometheus/prometheus-k8s-rules.yaml
|
|
kctl apply -f manifests/prometheus/prometheus-k8s-svc.yaml
|
|
|
|
kctl apply -f manifests/alertmanager/alertmanager-config.yaml
|
|
kctl apply -f manifests/alertmanager/alertmanager-service.yaml
|
|
|
|
# `kubectl apply` is currently not working for third party resources so we are
|
|
# using `kubectl create` here for the time being.
|
|
# (https://github.com/kubernetes/kubernetes/issues/29542)
|
|
kctl create -f manifests/prometheus/prometheus-k8s.yaml
|
|
kctl create -f manifests/alertmanager/alertmanager.yaml
|
|
|