首页 > 解决方案 > 是否可以使用 kubectl 显示 k8s 网络拓扑?

问题描述

我在我的 CentOS 7.7 服务器中安装了 minikube。

里面有几个豆荚:

[dele@att root]$ kubectl get pods --all-namespaces -o wide
NAMESPACE              NAME                                        READY   STATUS    RESTARTS   AGE   IP           NODE       NOMINATED NODE   READINESS GATES
kube-system            coredns-f9fd979d6-4p6xg                     1/1     Running   1          23h   172.18.0.2   minikube   <none>           <none>
kube-system            etcd-minikube                               1/1     Running   0          22h   172.17.0.2   minikube   <none>           <none>
kube-system            kube-apiserver-minikube                     1/1     Running   0          22h   172.17.0.2   minikube   <none>           <none>
kube-system            kube-controller-manager-minikube            1/1     Running   1          23h   172.17.0.2   minikube   <none>           <none>
kube-system            kube-proxy-4k468                            1/1     Running   1          23h   172.17.0.2   minikube   <none>           <none>
kube-system            kube-scheduler-minikube                     1/1     Running   1          23h   172.17.0.2   minikube   <none>           <none>
kube-system            storage-provisioner                         1/1     Running   2          23h   172.17.0.2   minikube   <none>           <none>
kubernetes-dashboard   dashboard-metrics-scraper-c95fcf479-k7zpn   1/1     Running   1          23h   172.18.0.3   minikube   <none>           <none>
kubernetes-dashboard   kubernetes-dashboard-5c448bc4bf-f9swt       1/1     Running   1          23h   172.18.0.4   minikube   <none>           <none>

但是我看不到清晰的网络拓扑图,是否可以使用显示网络拓扑kubectl

标签: kuberneteskubectl

解决方案


This is not possible out of the box with kubernetes (and kubectl) as far as I know. With additional software in your cluster I know about three possiblities with visualization:

  1. Istio has the possibility to visualize the communication within the mesh with kiali (For reference: https://istio.io/latest/docs/tasks/observability/kiali/)
  2. The second option is spekt8
  3. Weavescope comes with agents that gather data and visualizes them

Despite these options others could exist and I would really like to see more options because not everyone wants to add Istio and accept the performance impact just to visualize the pod/network landscape.

And as far as I understand spekt8 it's more about the visualization of relations between Kubernetes resources than about network topology visualization.

Weavescope needs cluster administration rights therefore it isn't advisable to make it public accessible without setting up some form of authentication.


推荐阅读