Files
macos-tools/docs/k8s-context.md
gaoandClaude fc9371e443 feat: 完成企业级 DevOps 基础设施部署
## 🏗️ 新增功能
- **shared/**: 完整的基础组件部署方案
  - docker-compose.yml: 统一编排所有基础服务
  - .env.example: 标准化环境变量配置
  - prometheus/prometheus.yml: 监控配置
  - bin/up.sh & down.sh: 一键部署脚本
  - README.md: 完整的使用文档

## 🛠️ 核心服务
- **数据库层**: PostgreSQL 16 + MySQL 8 (统一密码: 123456)
- **缓存层**: Redis 7 (密码: 123456)
- **代码管理**: GitLab CE + Gitea (双代码仓库)
- **镜像仓库**: Harbor (Docker Registry)
- **监控层**: Prometheus + Grafana + cAdvisor
- **网关反代**: Traefik v3.1

## 🔧 技术优化
- 所有端口统一使用 2xx80 系列,避免端口冲突
- 统一网络架构 (core network),支持多项目接入
- 完善的健康检查和服务依赖配置
- 支持 ARM64 架构 (MySQL 8 兼容性修复)

## 📚 文档更新
- SYSTEM-CONFIG.md: 系统配置文档完善
- harbor/README.md: Harbor 模块使用说明
- docs/: 完整的部署和运维文档

## 🚀 部署说明
所有服务已成功启动并通过验证:
- GitLab: http://localhost:28082 (root/SecurePass2024!)
- Gitea: http://localhost:23000
- Harbor: http://localhost:28081
- Grafana: http://localhost:23001 (admin/123456)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
2025-10-22 00:19:41 +08:00

2.3 KiB
Raw Permalink Blame History

Kubernetes Context(DevOps 基础设施)

本文件供 Claude / CI 任务加载,描述当前集群、命名空间、组件与访问约束。 环境:Mac Studio Ultra(192GB) + OrbStack Kubernetes(本地 80/443)

集群信息

  • 集群名称:macstudio-orbstack
  • Kubernetes 版本:v1.29+(本地)
  • Ingress:Nginx(shared 80/443),域名使用 *.127.0.0.1.nip.io
  • 容器注册中心:Harbor(私有)
  • 源码仓库:Gitea(私有)
  • CI/CD:GitLab Runner(容器或 K8s 安装)

命名空间(Namespaces)

  • shared-base:PostgreSQL / Redis /(可选 MinIO)
  • devops:Gitea / Harbor / GitLab Runner / Prometheus / Grafana / Loki
  • app-bookstore、app-stock、app-words、app-gmc_new:业务命名空间

公共服务 DNS(ClusterIP)

  • PostgreSQL:postgresql.shared-base.svc.cluster.local:5432
  • Redis(示例前缀):redis.shared-base.svc.cluster.local:6379
  • Gitea:gitea.devops.svc.cluster.local:3000
  • Harbor:harbor-core.devops.svc.cluster.local:80

入口域名(Ingress 示例)

  • Gitea:https://gitea.127.0.0.1.nip.io
  • Harbor:https://harbor.127.0.0.1.nip.io
  • 业务统一根域:*.127.0.0.1.nip.io

资源与安全约束

  • NetworkPolicy:业务命名空间仅可访问 shared-base 数据端口
  • RBAC:devops 仅平台 SRE 管理;各 app-* 只管自己
  • Secrets:SealedSecrets / SOPS(不提交明文)
  • 存储:本地 hostPath(开发)或默认 StorageClass(生产)
  • 备份:Postgres WAL + 每日全量;Redis RDB + AOF;Harbor registry 持久化

Claude 执行约束(重要)

  • 仅允许生成 Helm values / K8s YAML 占位文件,禁止 kubectl apply / helm install
  • 必须遵循每个任务的 artifacts-allowlist 白名单输出
  • 输出结构固定:PLAN / ARTIFACTS / CHECKLIST / SELF-REVIEW

Helm Chart 仓库

添加仓库

helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo add gitea-charts https://dl.gitea.io/charts/
helm repo add goharbor https://goharbor.github.io/helm-charts/
helm repo update

部署文件路径

  • Gitea Values: /deploy/devops/helm-values/values-gitea.yaml
  • Harbor Values: /deploy/devops/helm-values/values-harbor.yaml

最后更新:2025-10-21