mirror of
https://github.com/carlosedp/cluster-monitoring.git
synced 2024-11-20 19:07:17 +01:00
53 lines
2.4 KiB
Bash
Executable File
53 lines
2.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
if [ -z "${KUBECONFIG}" ]; then
|
|
export KUBECONFIG=~/.kube/config
|
|
fi
|
|
|
|
# CAUTION - setting NAMESPACE will deploy most components to the given namespace
|
|
# however some are hardcoded to 'monitoring'. Only use if you have reviewed all manifests.
|
|
|
|
if [ -z "${NAMESPACE}" ]; then
|
|
NAMESPACE=monitoring
|
|
fi
|
|
|
|
kubectl create namespace "$NAMESPACE"
|
|
|
|
kctl() {
|
|
kubectl --namespace "$NAMESPACE" "$@"
|
|
}
|
|
|
|
kubectl apply -f manifests/k8s
|
|
|
|
kctl apply -f manifests/prometheus-operator
|
|
|
|
# Wait for CRDs to be ready.
|
|
printf "Waiting for Operator to register custom resource definitions..."
|
|
until kctl get customresourcedefinitions servicemonitors.monitoring.coreos.com > /dev/null 2>&1; do sleep 1; printf "."; done
|
|
until kctl get customresourcedefinitions prometheuses.monitoring.coreos.com > /dev/null 2>&1; do sleep 1; printf "."; done
|
|
until kctl get customresourcedefinitions alertmanagers.monitoring.coreos.com > /dev/null 2>&1; do sleep 1; printf "."; done
|
|
until kctl get servicemonitors.monitoring.coreos.com > /dev/null 2>&1; do sleep 1; printf "."; done
|
|
until kctl get prometheuses.monitoring.coreos.com > /dev/null 2>&1; do sleep 1; printf "."; done
|
|
until kctl get alertmanagers.monitoring.coreos.com > /dev/null 2>&1; do sleep 1; printf "."; done
|
|
echo "done!"
|
|
|
|
kctl apply -f manifests/node-exporter
|
|
kctl apply -f manifests/armexporter/daemonset.yaml
|
|
kctl apply -f manifests/armexporter/service.yaml
|
|
|
|
kctl apply -f manifests/kube-state-metrics/kube-state-metrics-cluster-role.yaml
|
|
kctl apply -f manifests/kube-state-metrics/kube-state-metrics-cluster-role-binding.yaml
|
|
kctl apply -f manifests/kube-state-metrics/kube-state-metrics-role.yaml
|
|
kctl apply -f manifests/kube-state-metrics/kube-state-metrics-role-binding.yaml
|
|
kctl apply -f manifests/kube-state-metrics/kube-state-metrics-service-account.yaml
|
|
kctl apply -f manifests/kube-state-metrics/kube-state-metrics-service.yaml
|
|
kctl apply -f manifests/kube-state-metrics/kube-state-metrics-deployment.yaml
|
|
|
|
kctl apply -f manifests/grafana/grafana-credentials.yaml
|
|
kctl apply -f manifests/grafana
|
|
find manifests/prometheus -type f ! -name prometheus-k8s-roles.yaml ! -name prometheus-k8s-role-bindings.yaml -exec kubectl --namespace "$NAMESPACE" apply -f {} \;
|
|
kubectl apply -f manifests/prometheus/prometheus-k8s-roles.yaml
|
|
kubectl apply -f manifests/prometheus/prometheus-k8s-role-bindings.yaml
|
|
kctl apply -f manifests/alertmanager/
|
|
kctl apply -f manifests/smtp-server/smtp.yaml
|