Files
ljwx-children/QUICK-REFERENCE.md
bruno a48c913971 feat: add complete Kubernetes deployment and CI/CD pipeline
Major Features:
- ☸️ Complete Helm Chart with OrbStack optimization
- 🐳 Production-ready multi-stage Dockerfile (ARM64 support)
- 🚀 One-click deployment script for Mac Studio + OrbStack
- 🔒 Comprehensive security integration (Trivy, Bandit, Safety, Gitleaks)
- 🤖 New k8s-helper Claude Code Skill for cluster management
- 🔄 Complete CI/CD pipeline with 8 stages
- 📚 Comprehensive deployment documentation

Deployment Components:
- Helm Chart with multi-environment support (dev/staging/prod)
- OrbStack-optimized values (single-node, local registry)
- All K8s resources: Deployment, Service, Ingress, ConfigMap, Secret, PVC, HPA
- Intelligent deployment script with auto-detection and verification
- Port forwarding automation

Claude Code Skills:
- k8s-helper: Cluster status, pod logs, health checks, port forwarding, shell access

CI/CD Pipeline:
- Code quality & security scanning
- Automated testing with coverage
- Multi-arch Docker builds (amd64, arm64)
- Container vulnerability scanning
- Auto-deploy to dev, manual approval for prod
- Post-deployment verification

Documentation:
- DEPLOYMENT-GUIDE.md: Complete 20+ page deployment guide
- QUICK-REFERENCE.md: Quick command reference
- CLAUDE.md: Updated project guide for Claude Code
- README.md: Updated with new features

Environment:
- Tested on Mac Studio (ARM64) + OrbStack K8s v1.33.5
- Docker 28.5.2, Helm v4.0.0, kubectl v1.33.3

🤖 Generated with Claude Code
Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
2025-12-30 19:07:29 +08:00

4.3 KiB
Raw Permalink Blame History

🚀 Gold Template - 快速参考

一键部署

./scripts/deploy-orbstack.sh

访问:http://localhost:8000

常用命令

部署管理

# 完整部署
./scripts/deploy-orbstack.sh

# 跳过构建
./scripts/deploy-orbstack.sh --skip-build

# 指定标签
./scripts/deploy-orbstack.sh --tag v1.0.0

# 卸载
helm uninstall gold-template -n gold-template

K8s 管理(使用 k8s-helper skill)

# 集群状态
python3 .claude/skills/k8s-helper/helper.py --action status

# 查看 Pods
python3 .claude/skills/k8s-helper/helper.py --action pods -n gold-template

# 查看日志
python3 .claude/skills/k8s-helper/helper.py --action logs -r <pod-name> -n gold-template

# 实时日志
python3 .claude/skills/k8s-helper/helper.py --action logs -r <pod-name> -n gold-template --follow

# 健康检查
python3 .claude/skills/k8s-helper/helper.py --action health -n gold-template

# 端口转发
python3 .claude/skills/k8s-helper/helper.py --action port-forward -r <pod-name> -n gold-template

# 进入 Shell
python3 .claude/skills/k8s-helper/helper.py --action shell -r <pod-name> -n gold-template

原生 kubectl 命令

# 查看资源
kubectl get pods -n gold-template
kubectl get svc -n gold-template
kubectl get deployments -n gold-template

# 查看日志
kubectl logs -f -n gold-template -l app.kubernetes.io/name=gold-template

# 描述资源
kubectl describe pod -n gold-template <pod-name>

# 端口转发
kubectl port-forward -n gold-template svc/gold-template 8000:80

# 进入 Pod
kubectl exec -it -n gold-template <pod-name> -- /bin/bash

Helm 命令

# 列出 releases
helm list -n gold-template

# 查看状态
helm status gold-template -n gold-template

# 查看历史
helm history gold-template -n gold-template

# 升级
helm upgrade gold-template ./deployment/helm/gold-template -n gold-template

# 回滚
helm rollback gold-template -n gold-template

# 卸载
helm uninstall gold-template -n gold-template

Docker 命令

# 构建镜像
docker build -t localhost:5000/gold-template:latest .

# 查看镜像
docker images | grep gold-template

# 运行容器(本地测试)
docker run -p 8000:8000 localhost:5000/gold-template:latest

# 清理未使用镜像
docker image prune -a

开发命令

# 设置环境
./scripts/setup.sh

# 启动开发服务器
./scripts/dev.sh

# 运行测试
./scripts/test.sh

# 代码格式化
black .

# 代码检查
flake8 .

# 类型检查
mypy src/

Claude Code Skills

# 代码审查
python3 .claude/skills/code-review/review.py

# 生成测试
python3 .claude/skills/test-generator/generate.py

# 重构建议
python3 .claude/skills/refactor-assistant/assistant.py

# API 设计
python3 .claude/skills/api-designer/design.py

# K8s 管理
python3 .claude/skills/k8s-helper/helper.py --action status

测试 API

# 健康检查
curl http://localhost:8000/health

# 根路径
curl http://localhost:8000

# API 文档
open http://localhost:8000/docs

故障排查

# 查看 Pod 状态
kubectl get pods -n gold-template

# 查看 Pod 详情
kubectl describe pod -n gold-template <pod-name>

# 查看日志
kubectl logs -n gold-template <pod-name>

# 查看事件
kubectl get events -n gold-template --sort-by='.lastTimestamp'

# 检查 Service
kubectl get svc -n gold-template

# 检查端口转发
ps aux | grep "kubectl port-forward"

环境变量

# 查看 Secret
kubectl get secret gold-template-secret -n gold-template -o yaml

# 编辑 Secret
kubectl edit secret gold-template-secret -n gold-template

# 从 .env 创建 Secret
kubectl create secret generic gold-template-secret \
  --from-env-file=.env \
  -n gold-template \
  --dry-run=client -o yaml | kubectl apply -f -

文件位置

  • 部署脚本: scripts/deploy-orbstack.sh
  • Helm Chart: deployment/helm/gold-template/
  • OrbStack 配置: deployment/helm/gold-template/values-orbstack.yaml
  • Dockerfile: Dockerfile
  • CI/CD: .github/workflows/complete-cicd.yml
  • K8s Helper: .claude/skills/k8s-helper/helper.py
  • 完整指南: DEPLOYMENT-GUIDE.md

快速链接


提示: 将此文件保存为书签,方便快速查找命令!