apiVersion: v1
kind: Pod
metadata:
  name: test-projected-volume-downwardapi
  labels:
    zone: us-est-coast
    cluster: test-cluster1
    rack: rack-22
spec:
  containers:
    - name: client-container
      image: busybox
      command: ["sh", "-c"]
      args:
        - while true; do
          if [[ -e /etc/podinfo/labels ]]; then
          echo -en '\n\n'; echo '/etc/podinfo/labels:'; cat /etc/podinfo/labels; fi;
          echo -en '\n\n'; echo -n 'MY_NODE_NAME:'; echo $MY_NODE_NAME;
          echo -en '\n\n'; echo -n 'MY_POD_NAME:'; echo $MY_POD_NAME;
          sleep 5;
          done;
      resources:
        limits:
          memory: "32Mi"
          cpu: "50m"
      env:
        - name: MY_NODE_NAME
          valueFrom:
            fieldRef:
              fieldPath: spec.nodeName
        - name: MY_POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
      volumeMounts:
        - name: podinfo
          mountPath: /etc/podinfo
          readOnly: true
  volumes:
    - name: podinfo
      projected:
        sources:
          - downwardAPI:
              items:
                - path: "labels"
                  fieldRef:
                    fieldPath: metadata.labels
