Copy Files and Directories from Containers in Kubernetes

This blog post will show you how to copy files or directories stored inside containers running on Kubernetes.

In my case, I am using Azure Kubernetes Service (AKS) cluster; however, this solution will work on any Kubernetes cluster.

Kubectl CP

The following command will copy the bin directory’s content inside my MariaDB container to the computer that I’m running the command from (my laptop).

kubectl cp deploycontainers-mariadb-0:/bin /home/

For more Kubernetes commands visit the main category page.

Success! You're on the list.