Files & Shell to containers

Copy files

# kubectl - Copy files from source to destination
# kubectl cp SOURCE_PATH DEST_PATH
kubectl cp /tmp/test.txt nginx-pod:/var/www/html/test.txt

# oc - Copy files from source to destination
# oc cp SOURCE_PATH DEST_PATH
oc cp /tmp/test.txt nginx-pod:/var/www/html/test.txt

Rsync Files

# rsync binary must exist in both local and container filesystem
# oc rsync SOURCE_PATH DEST_PATH

oc rsync /tmp/test.txt nginx-pod:/var/www/html/test.txt

Exec into files

# kubectl
kubectl exec -it nginx-pod -- /bin/sh

OCP RSH

oc rsh nginx-pod

# to rsh into specific container in a pod
oc rsh nginx-pod --container some-container