chore: add current provisioning state before migration
This commit is contained in:
parent
a9703b4748
commit
50745b0f22
660 changed files with 88126 additions and 0 deletions
|
|
@ -0,0 +1,82 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
echo "🔧 Installing Monitoring Stack (Development Profile)"
|
||||
|
||||
# Create monitoring namespace
|
||||
kubectl create namespace monitoring --dry-run=client -o yaml | kubectl apply -f -
|
||||
|
||||
# Install minimal Prometheus for development
|
||||
echo "📊 Installing minimal Prometheus for development..."
|
||||
kubectl apply -f - <<EOF
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: prometheus
|
||||
namespace: monitoring
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: prometheus
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: prometheus
|
||||
spec:
|
||||
containers:
|
||||
- name: prometheus
|
||||
image: prom/prometheus:v2.48.0
|
||||
args:
|
||||
- --config.file=/etc/prometheus/prometheus.yml
|
||||
- --storage.tsdb.path=/prometheus/
|
||||
- --web.console.libraries=/etc/prometheus/console_libraries
|
||||
- --web.console.templates=/etc/prometheus/consoles
|
||||
- --storage.tsdb.retention.time=24h
|
||||
ports:
|
||||
- containerPort: 9090
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /etc/prometheus/
|
||||
- name: storage
|
||||
mountPath: /prometheus/
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: prometheus-config
|
||||
- name: storage
|
||||
emptyDir: {}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: prometheus-config
|
||||
namespace: monitoring
|
||||
data:
|
||||
prometheus.yml: |
|
||||
global:
|
||||
scrape_interval: 15s
|
||||
scrape_configs:
|
||||
- job_name: 'kubernetes-nodes'
|
||||
kubernetes_sd_configs:
|
||||
- role: node
|
||||
- job_name: 'kubernetes-pods'
|
||||
kubernetes_sd_configs:
|
||||
- role: pod
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: prometheus
|
||||
namespace: monitoring
|
||||
spec:
|
||||
selector:
|
||||
app: prometheus
|
||||
ports:
|
||||
- port: 9090
|
||||
targetPort: 9090
|
||||
type: ClusterIP
|
||||
EOF
|
||||
|
||||
echo "✅ Development monitoring stack installed successfully"
|
||||
echo "📊 Access Prometheus at: kubectl port-forward -n monitoring svc/prometheus 9090:9090"
|
||||
30
.provisioning/extensions/taskservs/monitoring/manifest.yaml
Normal file
30
.provisioning/extensions/taskservs/monitoring/manifest.yaml
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
name: monitoring
|
||||
version: 2.1.0
|
||||
type: taskserv
|
||||
description: Comprehensive monitoring stack with Prometheus, Grafana, and AlertManager
|
||||
author: DevOps Team
|
||||
requires:
|
||||
- kubectl
|
||||
- helm
|
||||
permissions:
|
||||
- cluster-admin
|
||||
- monitoring-namespace
|
||||
profiles:
|
||||
- production
|
||||
- staging
|
||||
- development
|
||||
hooks:
|
||||
pre_taskserv_install: hooks/validate-cluster.nu
|
||||
post_taskserv_install: hooks/setup-dashboards.nu
|
||||
configuration:
|
||||
prometheus:
|
||||
retention: "30d"
|
||||
storage_size: "50Gi"
|
||||
grafana:
|
||||
admin_password: "from_secrets"
|
||||
plugins:
|
||||
- grafana-piechart-panel
|
||||
- grafana-clock-panel
|
||||
alertmanager:
|
||||
slack_webhook: "from_secrets"
|
||||
email_config: "from_secrets"
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
echo "🔧 Installing Monitoring Stack (Production Profile)"
|
||||
|
||||
# Create monitoring namespace
|
||||
kubectl create namespace monitoring --dry-run=client -o yaml | kubectl apply -f -
|
||||
|
||||
# Add Prometheus Helm repository
|
||||
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
|
||||
helm repo update
|
||||
|
||||
# Install Prometheus Operator
|
||||
echo "📊 Installing Prometheus Operator..."
|
||||
helm upgrade --install prometheus-operator prometheus-community/kube-prometheus-stack \
|
||||
--namespace monitoring \
|
||||
--set prometheus.prometheusSpec.retention=30d \
|
||||
--set prometheus.prometheusSpec.storageSpec.volumeClaimTemplate.spec.resources.requests.storage=50Gi \
|
||||
--set grafana.adminPassword="${GRAFANA_ADMIN_PASSWORD:-admin123}" \
|
||||
--set alertmanager.config.global.slack_api_url="${SLACK_WEBHOOK_URL:-}" \
|
||||
--wait
|
||||
|
||||
# Install additional monitoring tools
|
||||
echo "📈 Installing additional monitoring components..."
|
||||
|
||||
# Node Exporter DaemonSet
|
||||
kubectl apply -f - <<EOF
|
||||
apiVersion: apps/v1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: node-exporter
|
||||
namespace: monitoring
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: node-exporter
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: node-exporter
|
||||
spec:
|
||||
containers:
|
||||
- name: node-exporter
|
||||
image: prom/node-exporter:v1.7.0
|
||||
args:
|
||||
- --path.procfs=/host/proc
|
||||
- --path.sysfs=/host/sys
|
||||
- --collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)
|
||||
ports:
|
||||
- containerPort: 9100
|
||||
name: metrics
|
||||
volumeMounts:
|
||||
- name: proc
|
||||
mountPath: /host/proc
|
||||
readOnly: true
|
||||
- name: sys
|
||||
mountPath: /host/sys
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: proc
|
||||
hostPath:
|
||||
path: /proc
|
||||
- name: sys
|
||||
hostPath:
|
||||
path: /sys
|
||||
hostNetwork: true
|
||||
hostPID: true
|
||||
EOF
|
||||
|
||||
# Install Blackbox Exporter for endpoint monitoring
|
||||
helm upgrade --install blackbox-exporter prometheus-community/prometheus-blackbox-exporter \
|
||||
--namespace monitoring \
|
||||
--wait
|
||||
|
||||
# Create ServiceMonitor for custom applications
|
||||
kubectl apply -f - <<EOF
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
name: custom-app-metrics
|
||||
namespace: monitoring
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: custom-app
|
||||
endpoints:
|
||||
- port: metrics
|
||||
interval: 30s
|
||||
path: /metrics
|
||||
EOF
|
||||
|
||||
echo "✅ Monitoring stack installed successfully"
|
||||
echo "🌐 Access Grafana at: kubectl port-forward -n monitoring svc/prometheus-operator-grafana 3000:80"
|
||||
echo "📊 Access Prometheus at: kubectl port-forward -n monitoring svc/prometheus-operator-prometheus 9090:9090"
|
||||
echo "🚨 Access AlertManager at: kubectl port-forward -n monitoring svc/prometheus-operator-alertmanager 9093:9093"
|
||||
26
.provisioning/extensions/taskservs/monitoring/staging/install-monitoring.sh
Executable file
26
.provisioning/extensions/taskservs/monitoring/staging/install-monitoring.sh
Executable file
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
echo "🔧 Installing Monitoring Stack (Staging Profile)"
|
||||
|
||||
# Create monitoring namespace
|
||||
kubectl create namespace monitoring --dry-run=client -o yaml | kubectl apply -f -
|
||||
|
||||
# Add Prometheus Helm repository
|
||||
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
|
||||
helm repo update
|
||||
|
||||
# Install Prometheus Operator (lighter configuration for staging)
|
||||
echo "📊 Installing Prometheus Operator (Staging)..."
|
||||
helm upgrade --install prometheus-operator prometheus-community/kube-prometheus-stack \
|
||||
--namespace monitoring \
|
||||
--set prometheus.prometheusSpec.retention=7d \
|
||||
--set prometheus.prometheusSpec.storageSpec.volumeClaimTemplate.spec.resources.requests.storage=10Gi \
|
||||
--set grafana.adminPassword="${GRAFANA_ADMIN_PASSWORD:-staging123}" \
|
||||
--set alertmanager.enabled=false \
|
||||
--set prometheus.prometheusSpec.replicas=1 \
|
||||
--wait
|
||||
|
||||
echo "✅ Staging monitoring stack installed successfully"
|
||||
echo "🌐 Access Grafana at: kubectl port-forward -n monitoring svc/prometheus-operator-grafana 3000:80"
|
||||
echo "📊 Access Prometheus at: kubectl port-forward -n monitoring svc/prometheus-operator-prometheus 9090:9090"
|
||||
Loading…
Add table
Add a link
Reference in a new issue