Downward API
Downward API exposes Pod and Container fields to running containers inside the pod. There are only two ways that we can do
- environment variables and
- files created by special volume type called downward API volume.
fieldRef is used to reference pod fields and resourceFieldRef is to reference containers fields in spec section.
The availability of information that we can reference for pod and containers through environment variables and volume can vary. For example, following pod fields information is common in case of both
metadata.namemetadata.namespacemetadata.uidetc
Some only for environment variables are,
spec.nodeNamespec.serviceAccountNamestatus.hostIPetc
Some only for volume are,
metadata.labelsmetadata.annotationsetc
This list is present on official documentation given in the references section.
For container fields, only their resources field can be accessed.