This procedure describes how to use the kubectl tool to download or upload files remotely from or to an Eclipse Che workspace.
-
A running instance of Eclipse Che. To install an instance of Eclipse Che, see Che 'quick-starts'.
-
Remote access to the Che workspace you intend to modify. For instructions see [remotely-accessing-workspaces-using-the-kubernetes-command-line-tool_remotely-accessing-workspaces].
-
The
kubectlbinary from the Kubernetes website. -
Verify the installation of
kubectlusing thekubectl versioncommand:
-
To download a local file named
downloadme.txtfrom a workspace container to the current home directory of the user, use the following in the Che remote shell.$ REMOTE_FILE_PATH=/projects/downloadme.txt $ NAMESPACE=che $ POD=workspace7b2wemdf3hx7s3ln.maven-74885cf4d5-kf2q4 $ CONTAINER=maven $ kubectl cp ${NAMESPACE}/${POD}:${REMOTE_FILE_PATH} ~/downloadme.txt -c ${CONTAINER} -
To upload a local file named
uploadme.txtto a workspace container in the/projectsdirectory:
$ LOCAL_FILE_PATH=./uploadme.txt
$ NAMESPACE=che
$ POD=workspace7b2wemdf3hx7s3ln.maven-74885cf4d5-kf2q4
$ CONTAINER=maven
$ kubectl cp ${LOCAL_FILE_PATH} ${NAMESPACE}/${POD}:/projects -c ${CONTAINER}
Using the preceding steps, the user can also download and upload directories.