kind: Pod
apiVersion: v1
metadata:
  name: downwardapi-volume-test
  labels:
    zone: Beijing
    rack: zhongguancun
    app: redis-master
  annotations:
    region: Asia-China
spec:
  volumes:
  - name: podinfo
    downwardAPI:
      defaultMode: 0420  #文件权限，默认0644
      items:
      - fieldRef:
          fieldPath: metadata.namespace
        path: "pod_namespace"
      - fieldRef:
          fieldPath: metadata.labels
        path: "pod_labels"
      - fieldRef:
          fieldPath: metadata.annotations
        path: "pod_annotations"
      - resourceFieldRef:
          containerName: downwardapi-volume-test
          resource: limits.cpu
        path: "cpu_limit"
      - resourceFieldRef:
          containerName: downwardapi-volume-test
          resource: requests.memory
          divisor: "1Mi"
        path: "mem_request"
  containers:
    - name: downwardapi-volume-test
      image: registry.cn-beijing.aliyuncs.com/wangxiaochun/pod-test:v0.1
      resources:
        requests:
          memory: "32Mi"
          cpu: "250m"
        limits:
          memory: "64Mi"
          cpu: "500m"
      volumeMounts:
      - name: podinfo
        mountPath: /etc/podinfo/
        readOnly: false
