目錄表

K8s 內的網路檢測

  1. 在 K8s 內起一個有 curl 的 busybox POD

    kubectl run --rm -it busybox --image yauritux/busybox-curl:latest --restart=Never

  2. 直接下 ping / nslookup / curl 等等命令進行網路檢測看結果
  3. 輸入 exit 離開看結果

因為在 Hyper-V 內建立一個 Ubuntu 20.04 VM 然後起一個 K8s Cluster 卻發現在 K8s 內的服務連不上 VM 內的服務, 以下是將檢測 K8s 網路的相關語法紀錄下來.

在 K8s 內起一個檢測的 pod

使用 pod 安裝相關工具與檢測

關閉檢測的 pod

kubectl delete deploy busybox
localadmin@devops1:~/test$ kubectl delete deploy busybox
deployment.apps "busybox" deleted

檢測跨 namespace 的 service

參考網址