How to get git commit sha1 using kubectl cmd?

江枫思渺然 提交于 2020-06-16 03:23:28

问题


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

kubectl get git_commit_sha1 [pod_name]

回答1:


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.

Example:

$ kubectl exec -ti podname -- git show

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.



来源:https://stackoverflow.com/questions/62258567/how-to-get-git-commit-sha1-using-kubectl-cmd

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!