Kubernetes Deployment Sync
Generates and synchronizes Kubernetes deployment manifests, services, and ingress configs from your application code. Detects ports, environment variables, and health checks automatically.
Command
/k8s-sync
Description
Analyzes your application to generate production-ready Kubernetes manifests. Detects the application type (Node.js, Python, Go, etc.), identifies exposed ports, environment variables, and health endpoints, then generates Deployment, Service, Ingress, ConfigMap, and HPA manifests.
Behavior
- Detect Application Type -- Scan
package.json,requirements.txt,go.mod,Dockerfileto determine the runtime - Extract Configuration -- Find exposed ports, environment variables, health check endpoints
- Generate Manifests -- Create Kubernetes YAML files in
k8s/directory:deployment.yaml-- Pod spec with resource limits, probes, and security contextservice.yaml-- ClusterIP service exposing detected portsingress.yaml-- Ingress with TLS configuration (if hostname provided)configmap.yaml-- Non-secret environment variableshpa.yaml-- HorizontalPodAutoscaler with sensible defaults
- Diff Existing -- If manifests already exist, show diff and confirm before overwriting
Output Format
Generated files are placed in the k8s/ directory at the project root:
k8s/
āāā deployment.yaml
āāā service.yaml
āāā ingress.yaml
āāā configmap.yaml
āāā hpa.yaml
Each file includes comments explaining the configuration choices.
Examples
Usage
/k8s-sync
/k8s-sync --namespace production --replicas 3
/k8s-sync --hostname api.example.com --tls
Generated Deployment (excerpt)
apiVersion: apps/v1 kind: Deployment metadata: name: my-app namespace: default labels: app.kubernetes.io/name: my-app app.kubernetes.io/managed-by: claude-k8s-sync spec: replicas: 2 selector: matchLabels: app.kubernetes.io/name: my-app template: spec: containers: - name: my-app image: my-app:latest # TODO: Pin to specific tag ports: - containerPort: 3000 # Detected from package.json start script resources: requests: cpu: 100m memory: 128Mi limits: cpu: 500m memory: 256Mi readinessProbe: httpGet: path: /health # Detected from route definitions port: 3000 envFrom: - configMapRef: name: my-app-config
Parameters
| Parameter | Default | Description |
|---|---|---|
--namespace | default | Target Kubernetes namespace |
--replicas | 2 | Initial replica count |
--hostname | none | Ingress hostname (skips ingress if not set) |
--tls | false | Enable TLS on ingress |
--registry | none | Container registry prefix |
Reviews
No reviews yet. Be the first to review this template!
Similar Templates
Git Commit Message Generator
Generates well-structured conventional commit messages by analyzing staged changes. Follows Conventional Commits spec with scope detection.
React Component Scaffolder
Scaffolds a complete React component with TypeScript types, Tailwind styles, Storybook stories, and unit tests. Follows project conventions automatically.
CI/CD Pipeline Generator
Generates GitHub Actions workflows for CI/CD including linting, testing, building, and deploying. Detects project stack automatically.