As you can read here, the Downward API is used to expose Pod
and Container
fields to a running Container:
There are two ways to expose Pod and Container fields to a running
Container:
Together, these two ways of exposing Pod and Container fields are
called the Downward API.
It is not meant to expose any information about other objects/resources such as ReplicaSet
or Deployment
, that manage such a Pod
.
You can see exactly what fields contains the yaml
manifest that describes a running Pod
by executing:
kubectl get pods <pod_name> -o yaml
The example fragment of its output may look as follows:
apiVersion: v1
kind: Pod
metadata:
annotations:
<some annotations here>
...
creationTimestamp: "2020-10-08T22:18:03Z"
generateName: nginx-deployment-7bffc778db-
labels:
app: nginx
pod-template-hash: 7bffc778db
name: nginx-deployment-7bffc778db-8fzrz
namespace: default
ownerReferences:
- apiVersion: apps/v1
blockOwnerDeletion: true
controller: true
kind: ReplicaSet
name: nginx-deployment-7bffc778db
...
As you can see, in metadata
section it contains ownerReferences
which in the above example contains one reference to a ReplicaSet
object by which this Pod
is managed. So you can get this particular ReplicaSet
name pretty easily as it is part of a Pod
yaml manifest.
However, you cannot get this way information about other Pods
managed by this ReplicaSet
.
Such information only can be obtained from the api server e.g by using kubectl client or programmatically with direct calls to the API.