4da6832b44
- 命名重构:tenant → customer(对齐后端 R1 重构) - Tenant → Customer / tenant_id → customerId - tenantStore → customerStore / getTenant/setTenant → getCustomer/setCustomer - cookie key tenant → customer, HTTP header tenantId → customerId - 后端契约更新:AuthResponse 加 sub 字段 - 接口 URL 修复:/auth/oidc/callback → /api/v1/auth/oidc/callback - 依赖升级:vue 3.5 / element-plus 2.8 / vite 5 / typescript 5.6 / sass 1.79 - 删 node-sass / scss / sass-loader / moment / mock/index.ts - 配置文件拆分:.env.development / .env.production / .env.example - 删除冗余 view/auth/auth/callback.vue 副本 - .gitignore 增加 dist / .opencode / tmp - 新增 AGENT.md 与后端风格对齐
Authentik 部署指南
目录结构
authentik-deploy/
├── 00-ns.yaml # Namespace
├── 01-postgres.yaml # PostgreSQL 数据库
├── 02-secret.yaml # 密钥(密码)
├── auth-helm-values.yaml # Authentik Helm 配置
├── 03-ingress.yaml # Ingress + TLS 证书
├── install.sh # 一键安装脚本
└── README.md # 本文件
部署步骤
1. 准备
确保集群已安装:
- Helm 3
- cert-manager(自动管理 HTTPS 证书)
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.14.0/cert-manager.yaml
2. 修改配置
编辑 02-secret.yaml,替换为真实随机密码:
# 生成随机密码
python3 -c "import secrets; print(secrets.token_urlsafe(32))"
将输出填入 authentik-secret-key 和 postgres-password。
编辑 03-ingress.yaml,将 YOUR_EMAIL@domain.com 替换为你的邮箱。
3. 执行部署
cd authentik-deploy
chmod +x install.sh
./install.sh
或手动按顺序执行:
kubectl create ns auth
kubectl apply -f 00-ns.yaml
kubectl apply -f 01-postgres.yaml
kubectl apply -f 02-secret.yaml
helm repo add authentik https://charts.goauthentik.io && helm repo update
helm install authentik authentik/authentik -n auth -f auth-helm-values.yaml
kubectl apply -f 03-ingress.yaml
4. 初始化
部署完成后访问:
- 首次设置: https://auth.violin-work.online/if/flow/initial/
- 设置管理员账号和密码
5. 验证
kubectl get pods -n auth
kubectl logs -n auth -l app.kubernetes.io/component=server --tail=20
后续:配置其他服务接入 Authentik(OIDC)
在 Authentik 中创建 Application
- 登录 Authentik Admin → Applications
- 点击 Create:
- Name: OpenViking(或任意名称)
- Slug: openviking
- Provider: 创建 OIDC Provider(见下方)
- 创建 Provider:
- Name: OpenViking Provider
- Client ID: openviking
- Client Secret: 生成一个随机值
- Redirect URIs:
https://viking.violin-work.online/-/oauth-callback/openviking/(根据实际调整)
OpenViking 配置 OIDC
在 OpenViking 的配置文件中加入:
{
"oidc": {
"issuer": "https://auth.violin-work.online",
"client_id": "openviking",
"client_secret": "你的client_secret"
}
}
KubeSphere 配置 OIDC
在 KubeSphere Web 控制台:
- 平台管理 → 访问控制 → 企业设置 → 第三方登录
- 填入 Authentik 的 OIDC 信息
维护
# 更新 Authentik
helm repo update && helm upgrade authentik authentik/authentik -n auth -f auth-helm-values.yaml
# 卸载
helm uninstall authentik -n auth && kubectl delete ns auth