Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get git commit sha1 using kubectl cmd?

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

kubectl get git_commit_sha1 [pod_name]
like image 370
Dave kam Avatar asked Jan 21 '26 09:01

Dave kam


1 Answers

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.

like image 68
Mark Watney Avatar answered Jan 23 '26 07:01

Mark Watney