k8s-manifest-generator
Create production-ready Kubernetes manifests for Deployments, Services, ConfigMaps, and Secrets following best practices and security standards. Use when generating Kubernetes YAML manifests, creating K8s resources, or implementing production-grade Kubernetes configurations.
- License 许可
- MIT
- 最近更新
- 2026-11-10
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- k8s-manifest-generator
- description
- Create production-ready Kubernetes manifests for Deployments, Services, ConfigMaps, and Secrets following best practices and security standards. Use when generating Kubernetes YAML manifests, creating K8s resources, or implementing production-grade Kubernetes configurations.
- last_verified
- 1793059200000
02 资源文件 6
- 资产文件assets/configmap-template.yaml6.1 KB
- 资产文件assets/deployment-template.yaml5.2 KB
- 资产文件assets/service-template.yaml3.6 KB
- 参考文档references/deployment-spec.md17.3 KB
- 参考文档references/details.md11.1 KB
- 参考文档references/service-spec.md14.0 KB
03 SKILL.md 正文
Kubernetes Manifest Generator
Step-by-step guidance for creating production-ready Kubernetes manifests including Deployments, Services, ConfigMaps, Secrets, and PersistentVolumeClaims.
Purpose
This skill provides comprehensive guidance for generating well-structured, secure, and production-ready Kubernetes manifests following cloud-native best practices and Kubernetes conventions.
When to Use This Skill
Use this skill when you need to:
- Create new Kubernetes Deployment manifests
- Define Service resources for network connectivity
- Generate ConfigMap and Secret resources for configuration management
- Create PersistentVolumeClaim manifests for stateful workloads
- Follow Kubernetes best practices and naming conventions
- Implement resource limits, health checks, and security contexts
- Design manifests for multi-environment deployments
Procedure
-
Gather requirements: workload type (stateless, stateful, batch), image and an immutable tag or digest, ports, config and secrets, storage, CPU and memory, replica count, health endpoints, and whether it is exposed outside the cluster. Ask for anything missing rather than inventing it.
-
Pick the workload kind: Deployment for stateless services, StatefulSet for stable identity or per-replica storage, Job or CronJob for batch.
-
Write the workload from
assets/deployment-template.yaml. Every container gets resource requests (and a memory limit), readiness and liveness probes, and a restricted security context:runAsNonRoot: true,allowPrivilegeEscalation: false,capabilities.drop: ["ALL"],seccompProfile.type: RuntimeDefault. That is what a namespace at therestrictedPod Security level admits. -
Expose it with a Service from
assets/service-template.yaml: ClusterIP by default, LoadBalancer only for direct external access. The Service selector must match the pod template labels exactly. -
Externalise configuration: ConfigMaps from
assets/configmap-template.yaml; Secrets never committed in plain text (use External Secrets, Sealed Secrets or SOPS). -
Add storage if needed: a PersistentVolumeClaim with an explicit
storageClassNameand access mode. -
Label consistently with the
app.kubernetes.io/*recommended labels (name,instance,version,component,part-of,managed-by). -
Validate offline against the target Kubernetes version, then server-side when a cluster is available:
kubeconform -strict -summary -kubernetes-version 1.37.0 manifests/ kubectl apply --dry-run=server -f manifests/kubeconform replaces kubeval, which is unmaintained and has no schemas for current Kubernetes. CRDs need extra
-schema-locationentries (seereferences/details.md, step 10).
References
references/details.md: the full step-by-step workflow with worked examples, multi-resource layout and common patternsreferences/deployment-spec.md: every Deployment field worth settingreferences/service-spec.md: Service types, traffic policies, headless Services and external endpoints
Best Practices Summary
- Always set resource requests and limits - Prevents resource starvation
- Implement health checks - Ensures Kubernetes can manage your application
- Use specific image tags - Avoid unpredictable deployments
- Apply security contexts - Run as non-root, drop capabilities
- Use ConfigMaps and Secrets - Separate config from code
- Label everything - Enables filtering and organization
- Follow naming conventions - Use standard Kubernetes labels
- Validate before applying -
kubeconform -strict, then server-side dry-run - Version your manifests - Keep in Git with version control
- Document with annotations - Add context for other developers
Troubleshooting
Pods not starting:
- Check image pull errors:
kubectl describe pod <pod-name> - Verify resource availability:
kubectl get nodes - Check events:
kubectl get events --sort-by='.lastTimestamp'
Service not accessible:
- Verify selector matches pod labels:
kubectl get endpointslices -l kubernetes.io/service-name=<service-name>(no ready endpoints means no matching ready pods) - Check service type and port configuration
- Test from within cluster:
kubectl run debug --rm -it --image=busybox:1.37 -- sh
ConfigMap/Secret not loading:
- Verify names match in Deployment
- Check namespace
- Ensure resources exist:
kubectl get configmap,secret
Next Steps
After creating manifests:
- Store in Git repository
- Set up CI/CD pipeline for deployment
- Consider using Helm or Kustomize for templating
- Implement GitOps with ArgoCD or Flux
- Add monitoring and observability
Related Skills
helm-chart-scaffolding- For templating and packaginggitops-workflow- For automated deploymentsk8s-security-policies- For advanced security configurations
04 同仓库更多 Skills
no-description
暂无简介
good-skill
Fixture skill that satisfies every rule.
broken-link
Links to a reference file that does not exist.
Bad_Name
Name violates the kebab-case rule and does not match the directory.
skill-authoring
Write, review, and validate portable agent skills in SKILL.md format. Use when creating a new skill, editing an existing one, or asked whether a skill follows the Agent Skills spec.
weigh-bags
Record scale readings for each bag — empty (tare), outbound, current, final — and reconcile them against the itemised inventory to find unaccounted weight. Use when the user gives a bag weight, says how heavy something is, weighs their luggage, or asks how close to the limit they are. Appends to bags.yaml and runs scripts/reconcile.py.