---
source: https://iinventedlight.com/library/notes/kubernetes-downward-api.md
title: "The Kubernetes downward API exposes Pod name, namespace, labels and limits to containers"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "CC-BY-4.0 (Kubernetes docs); CC-BY-4.0 (kubernetes/website (GitHub)); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: Kubernetes docs, Downward API; kubernetes/website (GitHub), Expose Pod Information to Containers Through Environment Variables (source page). CC-BY-4.0 (https://raw.githubusercontent.com/kubernetes/website/main/LICENSE). Copyright The Kubernetes Authors."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-18
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-18
as_of: 2026-11-18
confidence: medium
untested: "Not reproduced (2026-11-18). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-devops: kubernetes downward api"
tags: [kubernetes, downward-api, fieldref, environment-variables, volumes]
client: Librarian
sources:
  - id: S1
    title: "Downward API"
    publisher: Kubernetes docs
    url: https://kubernetes.io/docs/concepts/workloads/pods/downward-api/
    accessed: 2026-11-18
    license: "CC-BY-4.0"
  - id: S2
    title: "Expose Pod Information to Containers Through Environment Variables (source page)"
    publisher: kubernetes/website (GitHub)
    url: https://github.com/kubernetes/website/blob/main/content/en/docs/tasks/inject-data-application/environment-variable-expose-pod-information.md
    accessed: 2026-11-18
    license: "CC-BY-4.0"
---
# The Kubernetes downward API exposes Pod name, namespace, labels and limits to containers
**Answer:** Expose Pod fields to a container as environment variables (`fieldRef`, or `resourceFieldRef` for requests and limits) or as files in a `downwardAPI` volume. The downward API lets containers consume information about themselves or the cluster without using the Kubernetes client or API server.

## Example

```yaml
env:
  - name: MY_NODE_NAME
    valueFrom:
      fieldRef:
        fieldPath: spec.nodeName
  - name: MY_CPU_LIMIT
    valueFrom:
      resourceFieldRef:
        containerName: app
        resource: limits.cpu
```

## What is available where

- Env vars or volume: `metadata.name`, `metadata.namespace`, `metadata.uid`, and a single annotation or label such as `metadata.labels['mylabel']`.
- Environment variables only: the name of the pod's service account, the name of the node, the node IP address and the pod's primary IP address (the `spec` and `status` fields).
- Volume only: `metadata.labels` and `metadata.annotations` as a whole, one per line, as read-only plain text files.
- `resourceFieldRef` covers container-level requests and limits for resources such as CPU and memory.

## Behavior to know

- If a container's CPU and memory are resized while it runs, a downward API volume will be updated, but environment variables are not updated unless the container restarts.
- If CPU and memory limits are not specified, the kubelet exposes the maximum allocatable value for CPU and memory based on the node allocatable calculation.

## Why

Some applications assume a particular well-known environment variable holds a unique identifier. Wrapping the application is tedious and error-prone and violates the goal of low coupling; the Pod's name can be used instead.

## See also

- [kubernetes-configmaps](https://iinventedlight.com/library/notes/kubernetes-configmaps/)
- [kubernetes-resource-requests-limits](https://iinventedlight.com/library/notes/kubernetes-resource-requests-limits/)
- [kubernetes-labels-selectors](https://iinventedlight.com/library/notes/kubernetes-labels-selectors/)

## Claims

- id: C1
  claim: There are two ways to expose Pod fields: env vars and volume files.
  source: S1
  evidence: "There are two ways to expose Pod and container fields to a running container"

- id: C2
  claim: Env vars are not updated after a resize unless the container restarts.
  source: S1
  evidence: "environment variables will not be updated unless the container restarts"

- id: C3
  claim: MY_NODE_NAME comes from spec.nodeName.
  source: S2
  evidence: "environment variable gets its value from the Pod's `spec.nodeName` field"

## Sources

- [S1] Downward API. Kubernetes docs. https://kubernetes.io/docs/concepts/workloads/pods/downward-api/ . License: CC-BY-4.0. Accessed 2026-11-18.

- [S2] Expose Pod Information to Containers Through Environment Variables (source page). kubernetes/website (GitHub). https://github.com/kubernetes/website/blob/main/content/en/docs/tasks/inject-data-application/environment-variable-expose-pod-information.md . License: CC-BY-4.0. Accessed 2026-11-18.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Kubernetes docs, Downward API; kubernetes/website (GitHub), Expose Pod Information to Containers Through Environment Variables (source page). CC-BY-4.0 (https://raw.githubusercontent.com/kubernetes/website/main/LICENSE). Copyright The Kubernetes Authors. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
