Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

kubectl ls -- or some other way to see into a POD

I'm using kubectl cp to copy a jar file from my local file system into a the home directory of a POD in my minikube environment. However, the only way I can confirm that the copy succeeded is to issue a new kubectl cp command to copy the file back to a temp directory and compare the checksums. Is there a way to view the copied files directly?

like image 432
Greg Charles Avatar asked Jan 03 '18 20:01

Greg Charles


People also ask

Which command can be used to display the events for a pod?

You can use the event command of kubectl . To see what fields are possible you can use kubectl describe on any event.

How do I view pod config?

To view the entire configuration of the pod, just run kubectl describe pod nginx in your terminal. The terminal will now display the YAML for the pod, starting with the name nginx, its location, the Minikube node, start time and current status.


1 Answers

You can execute commands in a container using kubectl exec command.

For example:

to check files in any folder:

kubectl exec <pod_name> -- ls -la /

or to calculate md5sum of any file:

kubectl exec <pod_name> -- md5sum /some_file
like image 72
nickgryg Avatar answered Oct 18 '22 21:10

nickgryg