gpt4 book ai didi

kubernetes - 如何验证集群网络策略配置/支持

转载 作者:行者123 更新时间:2023-12-02 12:13:52 30 4
gpt4 key购买 nike

我正在尝试找出验证给定集群的网络策略配置的最佳方法。 According to the documentation

Network policies are implemented by the network plugin, so you must be using a networking solution which supports NetworkPolicy - simply creating the resource without a controller to implement it will have no effect.

假设我只能通过 kubectl 访问我的集群,我应该怎么做才能确保部署到集群中的网络策略资源得到遵守?

我知道可用的 CNI 和 related matrix capabilities .
我知道您可以检查与那些 CNI 相关的部署在 kube-system 下的 pod,并使用 for ex 验证相关功能。我分享的矩阵,但我想知道是否有更结构化的方法来验证当前安装的 CNI 和相关功能。

关于“实现它的 Controller ”,有没有办法获取与网络策略相关的附加组件/ Controller 列表?

最佳答案

Which the best approach to verify the network policy configuration for a given cluster?

如果您有权访问 pod,则可以运行测试以确保您的 NetworkPolicies 是否有效。您可以通过两种方式查看:

  • 使用 kubectl(kubectl get networkpolicies)读取您的 NetworkPolicy。
  • 测试您的端点以检查 NetworkPolicies 是否有效。

I wonder if there's a more structured approach to verify the current CNI installed and the related capabilities.

没有结构化的方法来检查您的 CNI。您需要了解 CNI 的工作原理才能在集群上识别它。例如,对于 Calico,您可以通过检查 calico pod 是否正在运行来识别它。 (kubectl get pods --all-namespaces --selector=k8s-app=calico-node)

Regarding the "controller to implement it", is there a way to get the list of add-on/controller related to the network policy?

“实现它的 Controller ”是对您正在使用的 CNI 的引用。

有一个工具叫做 Kubernetes Network Policies Viewer这允许您以图形方式查看您的 NetworkPolicy。这与您的问题无关,但它可能会帮助您可视化您的 NetworkPolicies 并了解它们在做什么。

关于kubernetes - 如何验证集群网络策略配置/支持,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59534752/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com