如何判断我的容器是否在Kubernetes集群中运行? [英] How do I tell if my container is running inside a Kubernetes cluster?
本文介绍了如何判断我的容器是否在Kubernetes集群中运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何确定我是否在kubernetes集群中运行?使用泊坞窗,我可以检查/.dockerinit
是否存在.有等同的东西吗?
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?
推荐答案
您可以在pod规范中将环境变量传递到您的容器.您甚至可以使用向下API 通过环境变量向容器公开一些容器信息. >.
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.
这篇关于如何判断我的容器是否在Kubernetes集群中运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文