目的
oc debugコマンドでOpenShiftのノード上のファイルを操作します。ただしファイルを変更するとノードが正しく実行できなくなる可能性があるのでご注意ください。
手順
ノードの確認
$ oc get nodes
NAME STATUS ROLES AGE VERSION
10.244.0.4 Ready master,worker 3d4h v1.19.0+e49167a
10.244.0.5 Ready master,worker 3d3h v1.19.0+e49167a
oc debugコマンドの実行
$ oc debug node/10.244.0.4
Starting pod/1024447-debug ...
To use host binaries, run `chroot /host`
Pod IP: 10.244.0.4
If you don't see a command prompt, try pressing enter.
sh-4.4# chroot /host
sh-4.2# ls -l
total 68
lrwxrwxrwx. 1 root root 7 Oct 14 2019 bin -> usr/bin
dr-xr-xr-x. 5 root root 4096 Feb 24 08:04 boot
drwxr-xr-x. 17 root root 2960 Feb 24 08:13 dev
drwxr-xr-x. 99 root root 12288 Feb 24 08:10 etc
drwxr-xr-x. 2 root root 4096 Dec 14 2017 home
lrwxrwxrwx. 1 root root 7 Oct 14 2019 lib -> usr/lib
lrwxrwxrwx. 1 root root 9 Oct 14 2019 lib64 -> usr/lib64
drwx------. 2 root root 16384 Oct 14 2019 lost+found
drwxr-xr-x. 2 root root 4096 Dec 14 2017 media
drwxr-xr-x. 2 root root 4096 Dec 14 2017 mnt
drwxr-xr-x. 8 root root 4096 Feb 24 08:10 opt
dr-xr-xr-x. 365 root root 0 Feb 24 08:03 proc
dr-xr-x---. 8 root root 4096 Feb 24 08:06 root
drwxr-xr-x. 34 root root 1000 Feb 24 08:12 run
lrwxrwxrwx. 1 root root 8 Oct 14 2019 sbin -> usr/sbin
drwxr-xr-x. 2 root root 4096 Dec 14 2017 srv
dr-xr-xr-x. 13 root root 0 Feb 24 08:03 sys
drwxrwxrwt. 10 root root 4096 Feb 27 12:20 tmp
drwxr-xr-x. 13 root root 4096 Oct 14 2019 usr
drwxr-xr-x. 20 root root 4096 Feb 24 08:07 var
sh-4.2# exit
exit
sh-4.4# exit
exit
Removing debug pod ...