[AZURE AKS] AKS 클러스터 노드에 접속

Seunghyun Moon·2022년 10월 11일
0

azure

목록 보기
1/2

AKS상의 k8s 노드에 들어가고 싶을 때가 있다.

azure 파워쉘이나 azure cli 상에서 아래 스텝대로 해본다.


  • 노드 이름 확인
PS /home/cho> kubectl get no -o wide
NAME                              STATUS   ROLES   AGE   VERSION   INTERNAL-IP    EXTERNAL-IP   OS-IMAGE             KERNEL-VERSION     CONTAINER-RUNTIME
aks-default-34557426-vmss000000   Ready    agent   67d   v1.21.9   10.240.0.4     <none>        Ubuntu 18.04.6 LTS   5.4.0-1073-azure   containerd://1.4.12+azure-3
aks-default-34557426-vmss000001   Ready    agent   49d   v1.21.9   10.240.0.35    <none>        Ubuntu 18.04.6 LTS   5.4.0-1073-azure   containerd://1.4.12+azure-3
aks-default-34557426-vmss000002   Ready    agent   49d   v1.21.9   10.240.0.66    <none>        Ubuntu 18.04.6 LTS   5.4.0-1073-azure   containerd://1.4.12+azure-3
aks-default-34557426-vmss000003   Ready    agent   49d   v1.21.9   10.240.0.97    <none>        Ubuntu 18.04.6 LTS   5.4.0-1073-azure   containerd://1.4.12+azure-3
aks-default-34557426-vmss000004   Ready    agent   49d   v1.21.9   10.240.0.128   <none>        Ubuntu 18.04.6 LTS   5.4.0-1073-azure   containerd://1.4.12+azure-3
aks-default-34557426-vmss000005   Ready    agent   49d   v1.21.9   10.240.0.159   <none>        Ubuntu 18.04.6 LTS   5.4.0-1073-azure   containerd://1.4.12+azure-3
aks-default-34557426-vmss000006   Ready    agent   49d   v1.21.9   10.240.0.190   <none>        Ubuntu 18.04.6 LTS   5.4.0-1073-azure   containerd://1.4.12+azure-3
aks-default-34557426-vmss000007   Ready    agent   49d   v1.21.9   10.240.0.221   <none>        Ubuntu 18.04.6 LTS   5.4.0-1073-azure   containerd://1.4.12+azure-3
aks-default-34557426-vmss000008   Ready    agent   49d   v1.21.9   10.240.0.252   <none>        Ubuntu 18.04.6 LTS   5.4.0-1073-azure   containerd://1.4.12+azure-3
aks-default-34557426-vmss000009   Ready    agent   49d   v1.21.9   10.240.1.27    <none>        Ubuntu 18.04.6 LTS   5.4.0-1073-azure   containerd://1.4.12+azure-3코드를 입력하세요
  • kubectl debug 명령어로 권한있는 컨테이너 실행 및 연결
PS /home/cho> kubectl debug node/aks-default-34557426-vmss000000 -it --image=mcr.microsoft.com/dotnet/runtime-deps:6.0  
Creating debugging pod node-debugger-aks-default-34557426-vmss000000-vrk92 with container debugger on node aks-default-34557426-vmss000000.
If you don't see a command prompt, try pressing enter.
root@aks-default-34557426-vmss000000:/# 
root@aks-default-34557426-vmss000000:/#            
root@aks-default-34557426-vmss000000:/# ls
bin  boot  dev  etc  home  host  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var코드를 입력하세요
  • 접속 성공
root@aks-default-34557426-vmss000000:/# chroot /host /bin/bash
root@aks-default-34557426-vmss000000:/# ls
NOTICE.txt  bin  boot  dev  etc  home  initrd.img  initrd.img.old  lib  lib64  lost+found  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var  vmlinuz  vmlinuz.old
root@aks-default-34557426-vmss000000:/# ls /etc/kubernetes/
azure.json  certs  manifests  volumeplugins

참조
https://learn.microsoft.com/ko-kr/azure/aks/node-access

profile
I live fullest

0개의 댓글