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

1/3/2018

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?

-- Greg Charles
kubectl
kubernetes
minikube

1 Answer

1/3/2018

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
-- nickgryg
Source: StackOverflow