GKE 上的 Istio - 准入 Webhook 无法注入 sidecar-porxy

Vai*_*ain 1 google-compute-engine google-cloud-platform kubernetes google-kubernetes-engine istio

我一直在尝试在现有的 GKE 集群上设置 Istio。

我按照 Istio 网站上提到的步骤进行安装 - 先决条件。

https://istio.io/latest/docs/setup/platform-setup/gke/

我有一个私有集群,因此我在先决条件中添加了防火墙规则。

gke-aiq-kubernetes-0a227ee8-all               default  INGRESS    1000      tcp,udp,icmp,esp,ah,sctp            False
gke-aiq-kubernetes-0a227ee8-master            default  INGRESS    1000      tcp:10250,tcp:443,tcp:15017         False
gke-aiq-kubernetes-0a227ee8-vms               default  INGRESS    1000      tcp:1-65535,udp:1-65535,icmp        False
Run Code Online (Sandbox Code Playgroud)

然后使用演示配置文件安装 istio。

istioctl install --set profile=demo
Run Code Online (Sandbox Code Playgroud)

然后验证安装

istioctl verify-install
Run Code Online (Sandbox Code Playgroud)

这说明一切都成功了。

我用 namecpace 标记为“instio-inject=enabled”,这样我就会自动注入 sidecar porxy。

但是当我尝试在命名空间中部署某些内容时,出现以下错误:

Error from server (InternalError): error when creating "pod-pending.yaml": Internal error occurred: failed calling webhook "sidecar-injector.istio.io": Post https://istiod.istio-system.svc:443/inject?timeout=30s: context deadline exceeded
Run Code Online (Sandbox Code Playgroud)

据我了解,存在一些连接问题,但我不知道如何调试它。

我尝试了 istio 的调试页面:

https://github.com/istio/istio/wiki/Troubleshooting-Istio#diagnostics

运行命令后:

kubectl get --raw /api/v1/namespaces/istio-system/services/https:istiod:https-webhook/proxy/inject -v4
Run Code Online (Sandbox Code Playgroud)

我确信这是连接问题:

t -v5
I1113 23:20:11.241079   40356 helpers.go:199] server response object: [{
  "metadata": {},
  "status": "Failure",
  "message": "the server is currently unable to handle the request",
  "reason": "ServiceUnavailable",
  "details": {
    "causes": [
      {
        "reason": "UnexpectedServerResponse",
        "message": "Error trying to reach service: 'dial tcp 10.48.3.25:15017: i/o timeout'"
      }
    ]
  },
  "code": 503
}]
F1113 23:20:11.241367   40356 helpers.go:114] Error from server (ServiceUnavailable): the server is currently unable to handle the request

Run Code Online (Sandbox Code Playgroud)

需要帮助,我是 GKE 新手。

Vai*_*ain 7

我想通了这个问题。

我使用 gcloud 配置文件配置了 7 个不同的 GCP 项目,并且在运行 gcloud 命令时处于不同的项目中。(所有 GKE 集群都具有相同的名称)

从命令行执行的步骤:

我从浏览器登录 GCP UI,搜索 VPC 下的防火墙,并在那里手动打开端口,它起作用了。

gcloud compute firewall-rules list --filter="name~gke-<clustername>-[0-9a-z]*-master"
Run Code Online (Sandbox Code Playgroud)

然后获取防火墙规则名称。

gcloud compute firewall-rules update <firewall rule name> --allow tcp:10250,tcp:443,tcp:15017
Run Code Online (Sandbox Code Playgroud)

这里的想法是添加准入挂钩所需的tcp:15017 。