Files
Severed-Infra/scripts/deploy-all.sh

57 lines
1.9 KiB
Bash

#!/bin/bash
set -e
cd ..
# 0. Environment Prep
echo "Importing severed-blog:v0.3 into k3d..."
k3d image import severed-blog:v0.3 -c severed-cluster
# 1. Foundation
kubectl apply -f namespaces.yaml
echo "Installing OpenEBS LocalPV Provisioner..."
kubectl apply -f https://openebs.github.io/charts/openebs-operator.yaml
kubectl apply -f infra/storage/openebs-sc.yaml
# 2. Monitoring Stack
echo "Creating Grafana Secrets..."
kubectl create secret generic grafana-secrets -n monitoring \
--from-literal=admin-user=admin \
--from-literal=admin-password=admin \
--dry-run=client -o yaml | kubectl apply -f -
# Kube State Metrics (KSM)
echo "Installing kube-state-metrics..."
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
helm upgrade --install kube-state-metrics prometheus-community/kube-state-metrics --namespace monitoring
kubectl apply -f infra/observer/loki.yaml
kubectl apply -f infra/observer/prometheus.yaml
kubectl apply -f infra/alloy-env.yaml
kubectl apply -f infra/alloy-setup.yaml
# 3. Application Layer
kubectl apply -f apps/severed-blog-config.yaml
kubectl apply -f apps/severed-blog.yaml
kubectl apply -f apps/severed-blog-service.yaml
kubectl apply -f apps/severed-blog-hpa.yaml
kubectl apply -f apps/severed-ingress.yaml
# 4. Visualization and Scaling Bridge
kubectl apply -f infra/observer/dashboard-json.yaml
kubectl apply -f infra/observer/grafana.yaml
echo "Installing Prometheus Adapter..."
helm upgrade --install prometheus-adapter prometheus-community/prometheus-adapter \
-n monitoring \
-f infra/observer/adapter-values.yaml
# 5. Dashboard Setup
kubectl apply -f infra/dashboard/dashboard-admin.yaml
kubectl apply -f infra/dashboard/permanent-token.yaml
echo "Deployment Complete. Retrieving Token..."
kubectl -n kubernetes-dashboard get secret admin-user-token -o jsonpath={".data.token"} | base64 -d
echo -e "\n"