Kubernetes列出所有容器ID [英] Kubernetes list all container id

查看:2748
本文介绍了Kubernetes列出所有容器ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设置了N个运行工人芹菜的复本豆荚.现在,我需要设置一个运行celery producer脚本的cron JOB,然后我需要能够使用标记的图像获取容器的容器ID.

I have set a N replica pods running workers celery. Now I need to setup a cron JOB running a celery producer script then I need to be able to get a container id for container using a tagged image.

因此,如何列出容器A使用标记图像C的多容器(容器A和容器B)吊舱的所有容器ID.

So how to list all container id for multi-containers (container A and container B) pod where container A is using a tagged image C.

推荐答案

一种方法是执行"kubectl获取容器"以获取所有容器名称,然后对每个容器执行"kubectl获取容器".请参阅此文档页面,以获取有关模板化参数的信息可以与"kubectl get pod"一起使用,以仅选择所需的字段(例如,图像).

One way is to do "kubectl get pods" to get all pod names, then do "kubectl get pod " for each pod. See this documentation page for information about the templating arguments you can use with "kubectl get pod" to just select the fields you want (for example, image).

这篇关于Kubernetes列出所有容器ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆