diff --git a/07_KubePrometheusStack/justfile b/07_KubePrometheusStack/justfile index bb25b9e..9ac6441 100644 --- a/07_KubePrometheusStack/justfile +++ b/07_KubePrometheusStack/justfile @@ -1,6 +1,7 @@ set fallback := true -export PROMETHEUS_NAMESPACE := env("PROMETHEUS_NAMESPACE", "prometheus") +export PROMETHEUS_NAMESPACE := env("PROMETHEUS_NAMESPACE", "monitoring") +#export GRAFANA_HOST := env("GRAFANA_HOST") [private] default: @@ -14,9 +15,22 @@ add-helm-repo: install: @just add-helm-repo + + gomplate -f kube-stack-config-values-gomplate.yaml -o kube-stack-config-values.yaml + @helm upgrade --cleanup-on-fail --install kube-prometheus-stack prometheus-community/kube-prometheus-stack \ + --namespace ${PROMETHEUS_NAMESPACE} \ + --create-namespace \ + --debug \ --wait \ -f kube-stack-config-values.yaml + echo "kubectl port-forward svc/prometheus-grafana 8080:80 -n monitoring" + echo "kubectl port-forward svc/prometheus-kube-prometheus-prometheus 9090 -n monitoring" + echo "kubectl port-forward svc/prometheus-kube-prometheus-alertmanager 9093 -n monitoring" + + echo "Get Grafana Password:" + echo "kubectl get secret --namespace monitoring -l app.kubernetes.io/component=admin-secret -o jsonpath=\"{.items[0].data.admin-password}\" | base64 --decode ; echo" + uninstall: - helm uninstall kube-prometheus-stack \ No newline at end of file + helm uninstall kube-prometheus-stack -n ${PROMETHEUS_NAMESPACE} \ No newline at end of file diff --git a/07_KubePrometheusStack/kube-stack-config-values-gomplate.yaml b/07_KubePrometheusStack/kube-stack-config-values-gomplate.yaml new file mode 100644 index 0000000..e65cd8c --- /dev/null +++ b/07_KubePrometheusStack/kube-stack-config-values-gomplate.yaml @@ -0,0 +1,13 @@ +grafana: + enabled: true + + ingress: + enabled: true + ingressClassName: traefik + annotations: + traefik.ingress.kubernetes.io/router.entrypoints: websecure + hosts: + - {{ .Env.GRAFANA_HOST }} + tls: + - hosts: + - {{ .Env.GRAFANA_HOST }} diff --git a/07_KubePrometheusStack/kube-stack-config-values.yaml b/07_KubePrometheusStack/kube-stack-config-values.yaml index af91202..2b5bc3f 100644 --- a/07_KubePrometheusStack/kube-stack-config-values.yaml +++ b/07_KubePrometheusStack/kube-stack-config-values.yaml @@ -1,78 +1,2 @@ -# -# Copyright © contributors to CloudNativePG, established as -# CloudNativePG a Series of LF Projects, LLC. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 -# - -# -- here you can pass the whole values directly to the kube-prometheus-stack chart -enabled: true -kubeControllerManager: - enabled: false -nodeExporter: - enabled: false -defaultRules: - create: true - rules: - alertmanager: false - etcd: false - configReloaders: false - general: false - k8s: true - kubeApiserver: false - kubeApiserverAvailability: false - kubeApiserverSlos: false - kubelet: true - kubeProxy: false - kubePrometheusGeneral: false - kubePrometheusNodeRecording: false - kubernetesApps: false - kubernetesResources: false - kubernetesStorage: false - kubernetesSystem: false - kubeScheduler: false - kubeStateMetrics: false - network: false - node: true - nodeExporterAlerting: false - nodeExporterRecording: true - prometheus: false - prometheusOperator: false - -#nodeSelector: - #workload: monitor -prometheus: - prometheusSpec: - podMonitorSelectorNilUsesHelmValues: false - ruleSelectorNilUsesHelmValues: false - serviceMonitorSelectorNilUsesHelmValues: false - probeSelectorNilUsesHelmValues: false - #nodeSelector: - #workload: monitor grafana: - enabled: true - # -- the grafana admin password - adminPassword: prom-operator - defaultDashboardsEnabled: false - sidecar: - dashboards: - enabled: true - #nodeSelector: - #workload: monitor -alertmanager: - enabled: true - #alertManagerSpec: - #nodeSelector: - #workload: monitor + enabled: true \ No newline at end of file diff --git a/prometheus-stack/README.md b/prometheus-stack/README.md index 8075d7f..b37524b 100644 --- a/prometheus-stack/README.md +++ b/prometheus-stack/README.md @@ -26,7 +26,9 @@ kubectl port-forward svc/prometheus-kube-prometheus-alertmanager 9093 -n monitor This will make Grafana accessible on http://localhost:8080, Prometheus on http://localhost:9090 and Alert Manager on http://localhost:9093 +Get Grafana Password via: +``` +kubectl get secret --namespace monitoring -l app.kubernetes.io/component=admin-secret -o jsonpath="{.items[0].data.admin-password}" | base64 --decode ; echo +``` Login for Grafana: **User:** admin -**Pwd:** prom-operator -