How do I tell if my container is running inside a Kubernetes cluster?

前端 未结 3 1371
慢半拍i
慢半拍i 2021-01-17 09:33

How can I tell whether or not I am running inside a kubernetes cluster? With docker I can check if /.dockerinit exist. Is there an equivalent?

3条回答
  •  不思量自难忘°
    2021-01-17 10:01

    You can pass environment variables to your containers in the pod spec. You can even expose some pod information to the containers via environment variables using the downward API.

提交回复
热议问题