線上 server 起了多個 Pod 有做 hpa 擴展,但某些原因部分 Pod 記憶體使用特別高,想透過 http 進 debug 介面內看,但透過 ingress 或 service ip 連的話,每次都會導到不同 Pod 裡,儘管矇對進到正確 Pod,但點了 debug 上的 url 又可能會跑到另一個 Pod 去,想問有什麼辦法可以指定連 podname-65846c475d-c2tzz?謝謝
podname-65846c475d-nxk6x 正常
podname-65846c475d-mznxv 正常
podname-65846c475d-c2tzz 記憶體飆高
pod 本身有個 debug 介面可查看效能追蹤
用port-forward轉去那個pod上面吧。
ref.
轉發一個本機連接埠到 Pod 連接埠
哇,謝謝啦,本以為 port-forward 只能轉 service,確認一下指令說明,原來都可以用。
Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in the pod
kubectl port-forward pod/mypod 5000 6000
Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in a pod selected by the
deployment
kubectl port-forward deployment/mydeployment 5000 6000
Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in a pod selected by the service
kubectl port-forward service/myservice 5000 6000
Listen on port 8888 locally, forwarding to 5000 in the pod
kubectl port-forward pod/mypod 8888:5000
Listen on port 8888 on all addresses, forwarding to 5000 in the pod
kubectl port-forward --address 0.0.0.0 pod/mypod 8888:5000
Listen on port 8888 on localhost and selected IP, forwarding to 5000 in the pod
kubectl port-forward --address localhost,10.19.21.23 pod/mypod 8888:5000
Listen on a random port locally, forwarding to 5000 in the pod
kubectl port-forward pod/mypod :5000