Skip to content
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-pod

Explanation

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