|NO.Z.00228|——————————|CloudNative|——|KuberNetes&細粒度許可權控制.V12|------------------------------------------------|RBAC.v04|線上測試驗證|
阿新 • • 發佈:2022-03-31
[CloudNative:KuberNetes&細粒度許可權控制.V12] [Applications.KuberNetes] [|DevOps|k8s|細粒度許可權控制|RBAC|臨時容器概念和配置|使用臨時容器線上debug|]
一、線上測試驗證
### --- 使用臨時容器測試demo-nginx容器是否可以呼叫臨時容器的命令 ~~~ # 進入容器檢視 ~~~ 注:-c是指定某個容器,剛才建立的容器時debugger [root@k8s-master01 ~]# kubectl exec -ti demo-nginx-6bdcdcc585-5wrx9 -c debugger -- sh
/ # ps aux
PID USER TIME COMMAND
1 root 0:00 /pause
6 root 0:00 sh -c sleep 36000000000 // 可以看到這是這個pod啟動的nginx的容器
12 root 0:00 sleep 36000000000
13 root 0:00 sh -c sleep 36000000000
18 root 0:00 sleep 36000000000
28 root 0:00 sh
33 root 0:00 sh
38 root 0:00 ps aux
/ # netstat -antp Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
### --- 什麼都沒有啟動
~~~ 設定臨時容器就可以不用在原有的容器中安裝一些維護工具,
~~~ 而是通過注入的臨時容器去提供一些維護工具,去呼叫維護
[root@k8s-master01 ~]# kubectl exec -ti demo-nginx-6bdcdcc585-5wrx9 -c debugger -- sh
/ # w
USER TTY IDLE TIME HOST
/ # top Mem: 1913164K used, 102756K free, 98680K shrd, 16K buff, 832500K cached CPU: 5.0% usr 5.0% sys 0.0% nic 90.0% idle 0.0% io 0.0% irq 0.0% sirq Load average: 0.37 0.53 0.78 2/514 46 PID PPID USER STAT VSZ %VSZ CPU %CPU COMMAND 13 0 root S 2388 0.1 0 0.0 sh -c sleep 36000000000
===============================END===============================
Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart ——W.S.Landor
來自為知筆記(Wiz)