Generate, lint, and validate production Kubernetes Deployment, Service, Ingress, and ConfigMap manifests adhering to CNCF standards.
Kubernetes (K8s) is an open-source container orchestration engine maintained by the Cloud Native Computing Foundation (CNCF). It automates the deployment, scaling, load balancing, and self-healing management of containerized workloads across distributed server clusters using declarative YAML manifests.
Managing Kubernetes clusters relies on declarative configuration files that define desired state. A single misplaced indentation character, missing resource request, or unconfigured liveness probe can cause catastrophic deployment rollouts, crash-loop backoffs (CrashLoopBackOff), or cluster-wide out-of-memory (OOMKilled) events. Validating Kubernetes manifests against official OpenAPI schemas ensures zero-downtime rolling updates and resilient infrastructure.
Core Kubernetes workload resources include Deployments (which manage Pod replicasets), Services (ClusterIP, NodePort, LoadBalancer for internal and external network routing), Ingress (HTTP/HTTPS reverse proxy routing with TLS termination), and ConfigMaps/Secrets for decoupling configuration from container images. Production manifests must define explicit CPU/Memory `requests` and `limits`, rolling update deployment strategies, and liveness/readiness probes.
apiVersion: apps/v1
kind: Deployment
metadata:
name: api-service
labels:
app.kubernetes.io/name: api-service
spec:
replicas: 3
selector:
matchLabels:
app: api-service
template:
metadata:
labels:
app: api-service
spec:
containers:
- name: api
image: registry.example.com/api:v1.4.2
ports:
- containerPort: 8080
resources:
requests:
cpu: "250m"
memory: "256Mi"
limits:
cpu: "1000m"
memory: "512Mi"
readinessProbe:
httpGet:
path: /healthz
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
---
apiVersion: v1
kind: Service
metadata:
name: api-service
spec:
type: ClusterIP
selector:
app: api-service
ports:
- port: 80
targetPort: 8080
A readiness probe determines if a container is ready to accept incoming network traffic. If it fails, Kubernetes removes the pod from service endpoints. A liveness probe determines if the container is healthy; if it fails, Kubernetes kills and restarts the container.
Requests allow the Kubernetes scheduler to find a node with enough available CPU and memory to host your Pod. Limits prevent a runaway process or memory leak in one Pod from consuming all node resources and starving other applications.