Kubernetes
Pod Manifest
Define a standalone Pod with a container, env, and probe.
By EZ4Code Team
podmanifestprobe
Code
# pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: api-pod
labels:
app: api
spec:
containers:
- name: api
image: myapp:1.0
ports:
- containerPort: 8080
env:
- name: LOG_LEVEL
value: "info"
livenessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 10
periodSeconds: 15
resources:
requests: { cpu: "100m", memory: "128Mi" }
limits: { cpu: "500m", memory: "256Mi" }
# kubectl apply -f pod.yaml
# kubectl get pods -o wide
# kubectl describe pod api-podExplanation
A Pod is the smallest deployable unit in Kubernetes and typically runs one container. Liveness probes let kubelet restart unhealthy containers, while resource requests/limits drive scheduling and throttling. Use apply to create or update resources declaratively.
More Kubernetes Snippets
Deployment & Rollout
Manage a replicated, rolling-updated workload.
Service Types
Expose Pods via ClusterIP, NodePort, and LoadBalancer services.
ConfigMap & Secret
Inject configuration and sensitive data into containers.
Ingress Routing
Route external HTTP traffic to services by host and path.
Labels & Selectors
Tag resources and query them with selectors.
kubectl Basics
Common kubectl commands for everyday operations.