How to Copy Container Files from DigitalOcean, Kubernetes

Download files from Kubernetes,

Step 1 – Connect to your digitalocean
Download the configuration file
To connect to your cluster from the command line, you need a configuration file on your administration machine that contains an authentication certificate and other connection information.

Download the configuration file

Step 2 Download the kubectl
The Kubernetes command-line tool, kubectl, allows you to run commands against Kubernetes clusters.

Example:kubectl passing config de view the Persistent Volume

 kubectl --kubeconfig="config.yaml" get pv

To get namespaces

 c:\kubernetes\kubectl --kubeconfig="config.yaml" get namespaces

To get the pods by passing the namespace,get pods from a namespaces: for example “ukgoodbye”

c:\kubernetes\kubectl --kubeconfig="config.yaml" get pods --namespace="ukgoodbye"

To copy or download the content for folder name “secondliveforstuff”

 c:\kubernetes\kubectl --kubeconfig="config.yaml" cp ukgoodbye/ukgoodbye-75556b549-22rks:secondliveforstuff  c:\kubernetes\secondliveforstuff

kubectl cp

kubectl –help

S C:\> kubectl cp --help
Copy files and directories to and from containers.

  # !!!Important Note!!!
  # Requires that the 'tar' binary is present in your container
  # image.  If 'tar' is not present, 'kubectl cp' will fail.
  # For advanced use cases, such as symlinks, wildcard expansion or
  # file mode preservation consider using 'kubectl exec'.

  # Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace 
  tar cf - /tmp/foo | kubectl exec -i -n   -- tar xf - -C /tmp/bar

  # Copy /tmp/foo from a remote pod to /tmp/bar locally
  kubectl exec -n   -- tar cf - /tmp/foo | tar xf - -C /tmp/bar

  # Copy /tmp/foo_dir local directory to /tmp/bar_dir in a remote pod in the default namespace
  kubectl cp /tmp/foo_dir :/tmp/bar_dir

  # Copy /tmp/foo local file to /tmp/bar in a remote pod in a specific container
  kubectl cp /tmp/foo :/tmp/bar -c 

  # Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace 
  kubectl cp /tmp/foo /:/tmp/bar

  # Copy /tmp/foo from a remote pod to /tmp/bar locally
  kubectl cp /:/tmp/foo /tmp/bar

  -c, --container='': Container name. If omitted, the first container in the pod will be chosen
      --no-preserve=false: The copied file/directory's ownership and permissions will not be preserved in the container

  kubectl cp   [options]

Use "kubectl options" for a list of global command-line options (applies to all commands).
PS C:\Users\MoussaSow\Downloads\kubernetes>