k8s中环境变量
作者:互联网
1,可以通过Dowmard API将pod的IP,名称和pod所在的namespace注入到容器的环境变量中:
env: - name: pod_name valueFrom: fieldRef: fieldPath: metadata.name - name: pod_namespace valueFrom: fieldRef: fieldPath: metadata.namespace
2,将容器资源信息注入到环境变量:
env: - name: cpu_request valueFrom: resourceFieldRef: containerName: test_container resource: requests.cpu
标签:fieldRef,name,valueFrom,namespace,pod,k8s,环境变量 来源: https://www.cnblogs.com/nizuimeiabc1/p/16371589.html