# ========== 一键安装脚本(Linux/macOS)============ # 保存为 install.sh,执行: chmod +x install.sh && ./install.sh #!/bin/bash set -e EMAIL="admin@violin-work.online" # ⚠️ 改成你的邮箱(Let's Encrypt 通知用) DOMAIN="auth.violin-work.online" # ⚠️ 改成你的域名 echo "=== 1. 创建 namespace ===" kubectl create ns auth --dry-run=client -o yaml | kubectl apply -f - echo "=== 2. 创建 Secret ===" kubectl apply -f 02-secret.yaml echo "=== 3. 部署 PostgreSQL ===" kubectl apply -f 01-postgres.yaml echo "=== 4. 等待 PostgreSQL 就绪 ===" kubectl wait --for=condition=ready pod -l app=authentik-postgres -n auth --timeout=120s echo "=== 5. 添加 Helm 源并安装 Authentik ===" helm repo add authentik https://charts.goauthentik.io --force-update helm repo update helm install authentik authentik/authentik -n auth -f auth-helm-values.yaml echo "=== 6. 部署 Ingress + 证书 ===" kubectl apply -f 03-ingress.yaml echo "=== 7. 等待 Authentik Server 就绪 ===" kubectl wait --for=condition=ready pod -l app.kubernetes.io/component=server -n auth --timeout=180s echo "" echo "=== 部署完成! ===" echo "访问: https://$DOMAIN" echo "初始设置: https://$DOMAIN/if/flow/initial/" echo "" echo "查看状态:" echo " kubectl get pods -n auth" echo " kubectl logs -n auth -l app.kubernetes.io/component=server --tail=50"