次のノードがあります。
$ kubectl get node
NAME STATUS ROLES AGE VERSION
peach-01-0101d1f4f250 Ready <none> 101d v1.30.0
peach-02-cac35be68802 Ready <none> 101d v1.30.0
peach-03-fd2f727688ee Ready <none> 37d v1.30.0
peach-01-0101d1f4f250ノードにkubectlだけでrootアクセスします。
$ kubectl debug node/peach-01-0101d1f4f250 -it --image=busybox
Creating debugging pod node-debugger-peach-01-0101d1f4f250-7ms5m with container debugger on node peach-01-0101d1f4f250.
If you don't see a command prompt, try pressing enter.
/ #
chrootします。
/ # chroot /host
root@peach-01-0101d1f4f250:/#
これでrootとしてnodeに入れました。
root@peach-01-0101d1f4f250:/# uname -a
Linux peach-01-0101d1f4f250 5.15.0-102-generic #112-Ubuntu SMP Tue Mar 5 16:50:32 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
exitを2回して戻ります。
root@peach-01-0101d1f4f250:/# exit
exit
/ # exit
debug用のPodがCompletedになっています。
$ kubectl get pod
NAME READY STATUS RESTARTS AGE
node-debugger-peach-01-0101d1f4f250-7ms5m 0/1 Completed 0 6m39s