本文介绍了从kubernetes API获取docker-image标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在构建docker-images,并在docker构建过程中添加一些元数据标签,例如:

We are building our docker-images, and adding a few metadata-labels during docker build, e.g:

docker build --label no.company.version=1.2.3 .

稍后我们在kubernetes窗格中使用此图像时,我们想从kubernetes api中检索该标签.对于跟踪除图像标签本身编码的元数据以外的其他元数据,这将很有用.

When we at some point later in time use this image in a kubernetes pod, we would like to retreive that labels from the kubernetes api. This would be useful for tracking other metadata than what is encoded in the image tag itself.

标签可通过节点上的docker获得,但我找不到在kubernetes中检索标签的任何方法.这可能吗?

The labels are available through docker on the node, but I can not find any way to retreive them in kubernetes. Is this possible?

推荐答案

从kubernetes api查询docker元数据.已打开PR以适应此请求.请关注
https://github.com/kubernetes/kubernetes/issues/47368

querying docker metadata from kubernetes api is not supported for now. there is a PR opened to accommodate this request. please follow
https://github.com/kubernetes/kubernetes/issues/47368

这篇关于从kubernetes API获取docker-image标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 18:05