kubernetes - 允许使用 Istio CNI 插件从 init 容器向 Kubernetes API 发出请求

标签 kubernetes istio cni

我配置了 istio,但没有启用 CNI 插件。

当时,我有一个带有服务帐户的 init 容器,它将调用 Kubernetes API 来验证一些事情(通过 kubectl)。

由于我启用了 CNI 插件,此初始化容器失败并显示以下消息:

The connection to the server 10.23.64.1:443 was refused - did you specify the right host or port?

我尝试删除所有网络策略以查看这是否是问题所在,但结果相同。 我还向服务帐户提供了该 pod 使用 cluster-admin 角色,但它没有达到目的。

我使用 Istio 1.6 和 1.7 分支进行了测试。

这里有什么问题吗?其他没有此初始化容器的 Pod 可以正常工作。

最佳答案

为了启用 istio cni 的 init 容器网络连接,请按照 istio documentation 中的解决方法指南进行操作。 :

Compatibility with application init containers

The Istio CNI plugin may cause networking connectivity problems for any application initContainers. When using Istio CNI, kubelet starts an injected pod with the following steps:

  1. The Istio CNI plugin sets up traffic redirection to the Istio sidecar proxy within the pod.
  2. All init containers execute and complete successfully.
  3. The Istio sidecar proxy starts in the pod along with the pod’s other containers.

Init containers execute before the sidecar proxy starts, which can result in traffic loss during their execution. Avoid this traffic loss with one or both of the following settings:

  • Set the traffic.sidecar.istio.io/excludeOutboundIPRanges annotation to disable redirecting traffic to any CIDRs the init containers communicate with.
  • Set the traffic.sidecar.istio.io/excludeOutboundPorts annotation to disable redirecting traffic to the specific outbound ports the init containers use.

关于kubernetes - 允许使用 Istio CNI 插件从 init 容器向 Kubernetes API 发出请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64356701/

相关文章:

docker - 如何在Kubernetes中定义网络

amazon-web-services - 在 Kubernetes 中使用 Terraform 输出

Istio 和(或与)Nginx 入口 Controller

kubernetes - Kubernetes 内部的 Istio CORS 和 SSL 问题

google-kubernetes-engine - 连接到 Istio 入口网关出现 404 错误

elasticsearch - 弹性查询 bool 必须匹配问题

nginx - 无法配置Kubernetes Nginx入口基本身份验证

kubernetes - 使用网络插件 "cni": cni config unintialized; Skipping pod

docker - 在k8s中使用cni代替静态路由表有什么好处

kubernetes - Kubernetes CNI与Kube-proxy