如何使用kubectl cmd获取git commit sha1? [英] How to get git commit sha1 using kubectl cmd?

查看:168
本文介绍了如何使用kubectl cmd获取git commit sha1?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用kubectl cmd获取特定pod的提交sha1,例如:

How can I using kubectl cmd to get specific pod's commit sha1 like:

kubectl get git_commit_sha1 [pod_name]


推荐答案

目前没有办法使用kubectl实现您想要的。它们唯一可能的方式是,如果您的Docker映像内置了 git 命令。在这种情况下,您可以使用 kubectl exec 获取所需的信息。

There is no way to achieve what you want at the moment using kubectl. They only possible way would be if your docker image have git command built in. In that case you could use kubectl exec to get the information you want.

示例:

$ kubectl exec -ti podname -- git show

或者,如果您真的认为自己的想法有意义并且可能对更多人有用,则可以在 kubernetes github问题页面上打开功能请求

Alternatively, if you really think your idea makes sense and may be useful to more people, you can open a feature request on kubernetes github issues page.

这篇关于如何使用kubectl cmd获取git commit sha1?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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