rpi.carlosedp.cluster-monit.../deploy

53 lines
2.4 KiB
Plaintext
Raw Normal View History

2018-03-02 01:03:53 +01:00
#!/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
2018-04-10 19:20:40 +02:00
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
2018-03-02 01:03:53 +01:00
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/
2018-03-03 14:52:00 +01:00
kctl apply -f manifests/smtp-server/smtp.yaml