K

K8s Manifest Command

Generate production-ready Kubernetes manifests with best practices built in. Creates Deployments, Services, Ingress, HPA, PDB, NetworkPolicies, and ConfigMaps/Secrets with proper resource limits, health checks, and security contexts.

CommandCommunitydevopsv1.0.0MIT
0 views0 copies

Command

/k8s-manifest

Description

Generates comprehensive Kubernetes manifests for deploying your application. Analyzes your project structure, Dockerfile, and environment configuration to produce production-ready YAML with security best practices, resource management, and observability.

Behavior

  1. Detect application type (web server, worker, cron job, etc.)
  2. Analyze resource requirements from Dockerfile and code
  3. Generate all required Kubernetes resources
  4. Validate manifests against best practices
  5. Output organized, well-commented YAML files

Generated Resources

Core Resources

# deployment.yaml apiVersion: apps/v1 kind: Deployment metadata: name: my-app labels: app.kubernetes.io/name: my-app app.kubernetes.io/version: "1.0.0" spec: replicas: 3 strategy: type: RollingUpdate rollingUpdate: maxSurge: 1 maxUnavailable: 0 selector: matchLabels: app.kubernetes.io/name: my-app template: spec: serviceAccountName: my-app securityContext: runAsNonRoot: true runAsUser: 1000 fsGroup: 1000 containers: - name: my-app image: registry.example.com/my-app:1.0.0 ports: - containerPort: 3000 protocol: TCP resources: requests: cpu: 100m memory: 128Mi limits: cpu: 500m memory: 512Mi livenessProbe: httpGet: path: /health port: 3000 initialDelaySeconds: 10 periodSeconds: 30 readinessProbe: httpGet: path: /ready port: 3000 initialDelaySeconds: 5 periodSeconds: 10 envFrom: - configMapRef: name: my-app-config - secretRef: name: my-app-secrets

Additional Resources Generated

ResourcePurpose
service.yamlClusterIP service for internal routing
ingress.yamlExternal access with TLS termination
hpa.yamlHorizontal Pod Autoscaler (CPU/memory)
pdb.yamlPod Disruption Budget for availability
networkpolicy.yamlNetwork segmentation rules
serviceaccount.yamlLeast-privilege service account
configmap.yamlNon-sensitive configuration
secret.yamlTemplate for sensitive values
kustomization.yamlKustomize base for environment overlays

Best Practices Applied

  • Resource requests and limits on every container
  • Liveness and readiness probes configured
  • Security context: non-root, read-only filesystem, no privilege escalation
  • Pod Disruption Budget to maintain availability during rollouts
  • Network policies to restrict traffic
  • Kubernetes-standard labels for identification
  • Anti-affinity rules for spreading pods across nodes

Examples

# Generate manifests for current project /k8s-manifest # Specify namespace and registry /k8s-manifest --namespace production --registry gcr.io/my-project # Generate with Helm chart structure /k8s-manifest --format helm # Generate for specific workload type /k8s-manifest --type cronjob --schedule "0 */6 * * *"
Community

Reviews

Write a review

No reviews yet. Be the first to review this template!

Similar Templates