Interview Prep/Real-World Interview/Write-a-Kubernetes-manifest tasks

Write a Deployment that uses the downward API to expose the pod name and node name to the app.

IntermediateHands-onWrite-a-Kubernetes-manifest tasks
Answer
env:
  - name: POD_NAME
    valueFrom: { fieldRef: { fieldPath: metadata.name } }
  - name: NODE_NAME
    valueFrom: { fieldRef: { fieldPath: spec.nodeName } }
  - name: MEM_LIMIT
    valueFrom:
      resourceFieldRef: { containerName: app, resource: limits.memory }

Key trick → The downward API lets the app log which pod and node it runs on, or size its caches from its own memory limit, without calling the Kubernetes API.

All Real-World Interview questions Roadmap: Interview readiness

More on Write-a-Kubernetes-manifest tasks