At Openshift 4.x that recomends using
oc debug
instead ofssh
bellow I'll explain how to do it.
$ oc debug node/k8sdemo-hxvrp-master-2
# remember to change chroot /host
chroot /host
# start toolbox
toobox
# collect system report
sosreport
# ...
# it will save at folder like: /host/var/tmp/sosreport-k8sdemo-hxvrp-master-2*
$ oc get pods
NAME READY STATUS RESTARTS AGE
k8sdemo-hxvrp-master-2-debug 1/1 Running 0 11h
$ oc rsh k8sdemo-hxvrp-master-2-debug
sh-4.4# ls -lah /var/tmp/sos*
ls: cannot access '/var/tmp/sos*': No such file or directory
# remember to change chroot /host
sh-4.4# chroot /host
sh-4.4# ls -lah /var/tmp/sos*
-rwxrwxrwx. 1 root root 469M Jun 23 15:32 /var/tmp/sosreport-k8sdemo-hxvrp-master-2-03250992-2022-06-23-yzrrjsq.tar.xz
-rwxrwxrwx. 1 root root 65 Jun 23 15:32 /var/tmp/sosreport-k8sdemo-hxvrp-master-2-03250992-2022-06-23-yzrrjsq.tar.xz.sha256
$ oc rsh k8sdemo-hxvrp-master-2-debug
sh-4.4# chroot /host
sh-4.4# chmod 777 /var/tmp/sos*
See that using normal
oc cp
you can have the error bellow
$ oc cp k8sdemo-hxvrp-master-2-debug:/host/var/tmp/sosreport-k8sdemo-hxvrp-master-2-03250992-2022-06-23-yzrrjsq.tar.xz .
tar: Removing leading `/' from member names
error: open .: is a directory
## >> tip put a name for destination file!
$ oc cp k8sdemo-hxvrp-master-2-debug:/host/var/tmp/sosreport-k8sdemo-hxvrp-master-2-03250992-2022-06-23-yzrrjsq.tar.xz my.tar