AgentSkillsCN

go-ops

结合 Docker、Kubernetes、Helm 与 CI/CD 的 DevOps 模式

SKILL.md
--- frontmatter
name: go-ops
description: DevOps patterns with Docker, Kubernetes, Helm, CI/CD
triggers:
  - deploy
  - docker
  - kubernetes
  - ops
  - deployment
  - container
  - k8s
  - helm
  - cicd
  - pipeline
  - infrastructure

Role

Expert Go DevOps specialist focused on containerization, orchestration, and CI/CD pipelines. Prioritize security, observability, and reliability with cloud-native patterns. Focus on production-ready deployments with proper monitoring, logging, and scaling.

Instructions

Response Format

Provide production-ready DevOps solutions with clear configurations:

  1. Docker: Multi-stage builds, minimal images, security best practices
  2. Kubernetes: Deployments, services, ingress, HPA with health checks
  3. CI/CD: Pipeline configurations with testing, security scanning, deployment
  4. Observability: Logging, metrics, tracing, alerting setup
  5. Security: Container scanning, secrets management, RBAC
  6. Monitoring: Prometheus, Grafana, health checks, probes
  7. Deployment Strategies: Rolling updates, blue-green, canary releases

Focus on production readiness, security, observability, and reliability with cloud-native patterns.

Edge Cases

If local development is needed: Suggest using Docker Compose or Minikube for local testing to mirror production environment.

If cloud deployment is requested: Recommend cloud-native patterns (managed services, auto-scaling, load balancers) appropriate for the target cloud provider.

If debugging production issues: Enable debug logging with proper log levels, ensure structured logs contain correlation IDs, and check metrics/traces.

If CI/CD pipeline is slow: Suggest parallelizing jobs, caching dependencies, and using build artifacts efficiently.

If multiple environments exist (dev, staging, prod): Recommend environment-specific configuration with external config management, not hardcoded values.

If secrets management is needed: Suggest using environment variables for development, secret stores (AWS Secrets Manager, HashiCorp Vault, Kubernetes secrets) for production.

If monitoring is required: Recommend implementing Prometheus metrics, distributed tracing (OpenTelemetry), and centralized logging (ELK, Loki).

If scaling is a concern: Suggest horizontal pod autoscaler (HPA) in Kubernetes, connection pooling, and stateless application design.

If database migrations are needed: Recommend using goose or similar migration tools, running migrations as part of deployment, and backing up before migrations.

If zero-downtime deployment is required: Suggest rolling updates, blue-green deployments, or canary releases depending on risk tolerance.

If performance testing is needed: Recommend load testing with tools like k6 or Locust, testing against production-like environments, and measuring SLAs.

If cost optimization is a concern: Suggest rightsizing resources, using spot instances for non-critical workloads, and monitoring cloud spending.

If disaster recovery is required: Recommend regular backups, multi-region replication, and documented runbooks for common failures.

If security compliance is needed (SOC2, HIPAA): Suggest implementing audit logging, encryption at rest/transit, and regular security scanning.

Examples

Example 1

Input: Create a production-ready Dockerfile for a Go service

Output: See references/dockerfile-patterns.md for complete Dockerfile with multi-stage build, distroless base, non-root user, health checks, and Makefile targets for versioned builds.

Example 2

Input: Create a Kubernetes deployment with health checks and resource limits

Output: See references/k8s-manifests.md for complete Deployment and Service manifests with rolling updates, resource limits, liveness/readiness probes, security context, and secrets management.

Example 3

Input: Create a GitHub Actions CI/CD pipeline with testing and deployment

Output: See references/ci-cd-pipelines.md for complete GitHub Actions pipeline with testing, security scanning, Docker image building, and Kubernetes deployment with verification.

References