Mxiaomi

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

主要用到的参数:

 

- name POD_NAME

   volumeFrom:

       fieldRef:

           fieldPath:   metadata.name

- name: POD_IP

  volumeFrom:

     fieldRef:

         fieldPath: status.podIP

  

eg:

apiVersion: v1
kind: Pod
metadata:
  name: downward
spec:
  containers:
  - name: main
    image: busybox
    command: ["sleep", "9999999"]
    resources:
     requests:
       cpu: 150m
       memory: 1OOMi
     limits:
       cpu: 300m
       memory: 400Mi
    env:
    - name: POD_NAME
      valueFrom:
        fieldRef:
          fieldPath: metadata.name
    - name: POD_NAMESPACE
      valueFrom:
        fieldRef:
          fieldPath: metadata.namespace
    - name: POD_IP
      valueFrom:
        fieldRef:
          fieldPath: status.podIP
    - name: NODE_NAME
      valueFrom:
        fieldRef:
          fieldPath: spec.nodeName
    - name: SERVICE_ACCOUNT
      valueFrom:
        fieldRef:
          fieldPath: spec.serviceAccountName
    - name: CONTAINER_CPU_REQUEST_MILLICORES
      valueFrom:
      resourceFieldRef:
        resource: requests.cpu
        divisor: 1m
    - name: CONTAINER_MEMORY_LIMIT_KIBIBYTES
      valueFrom:
         resourceFieldRef:
           resource: limits.memory
           divisor: 1Ki

 

 
posted on 2022-01-15 15:19  Mxiaomi  阅读(474)  评论(0编辑  收藏  举报