gpt4 book ai didi

kubernetes - 使用 istioctl 安装时在 Istio 1.4.0 中创建资源时超时

转载 作者:行者123 更新时间:2023-12-02 11:35:16 25 4
gpt4 key购买 nike

我正在尝试在新的 GKE 集群上安装 Istio 1.4.0。当我使用 soon to be deprecated Helm 安装过程,Istio 正常工作,我可以毫无问题地应用我自己的资源(网关、部署等),例如:

# Create namespace
kubectl create namespace istio-system

# Install Istio CRDs
helm template install/kubernetes/helm/istio-init --name istio-init --namespace istio-system | kubectl apply -f -

# Install Istio
helm template install/kubernetes/helm/istio --name istio --namespace istio-system \
--set gateways.enabled=true \
--set gateways.istio-ingressgateway.enabled=true \
--set gateways.istio-ingressgateway.sds.enabled=true \
--set gateways.istio-ingressgateway.externalTrafficPolicy="Local" \
--set global.disablePolicyChecks=false \
--set global.proxy.accessLogFile="/dev/stdout" \
--set global.proxy.accessLogEncoding="TEXT" \
--set grafana.enabled=true \
--set grafana.security.enabled=true \
--set kiali.enabled=true \
--set prometheus.enabled=true \
--set tracing.enabled=true \
| kubectl apply -f -

但是,当我尝试使用 istioctl 安装 Istio 时过程,例如:
istioctl manifest apply \
--set values.gateways.enabled=true \
--set values.gateways.istio-ingressgateway.enabled=true \
--set values.gateways.istio-ingressgateway.sds.enabled=true \
--set values.global.disablePolicyChecks=false \
--set values.global.proxy.accessLogFile="/dev/stdout" \
--set values.global.proxy.accessLogEncoding="TEXT" \
--set values.grafana.enabled=true \
--set values.grafana.security.enabled=true \
--set values.kiali.enabled=true \
--set values.prometheus.enabled=true \
--set values.tracing.enabled=true

...我无法创建资源作为 kubectl apply命令超时,例如:
$ kubectl apply -f default-gateway.yaml
Error from server (Timeout): error when creating "default-gateway.yaml": Timeout: request did not complete within requested timeout 30s

我尝试创建的每种类型的资源都会发生这种情况。有没有其他人经历过类似的事情或知道潜在的问题是什么?

正在运行 Istio analyze没有透露任何问题:
$ istioctl x analyze -k
✔ No validation issues found.

-- 编辑 --

尝试运行 busybox还有错误:
$ kubectl run -i --tty busybox --image=busybox --restart=Never -- sh
Error from server (InternalError): Internal error occurred: failed calling webhook "sidecar-injector.istio.io": Post https://istio-sidecar-injector.istio-system.svc:443/inject?timeout=30s: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

最佳答案

我想通了。问题是 istio-sidecar-injector服务,并且我正在使用私有(private) GKE 集群,该集群具有比非私有(private)集群更严格的默认防火墙规则。

通过 Helm process 安装 Istio 时, istio-sidecar-injector服务目标端口 443 :

$ kubectl get svc istio-sidecar-injector -n istio-system -o jsonpath='{.spec.ports[0]}'
map[name:https-inject port:443 protocol:TCP targetPort:443]

端口 443master 上默认打开防火墙规则(例如 gke-<cluster-name>-XXXXXXXX-master ),所以 istio-sidecar-injector可以成功运行。

但是,当通过新的 Istioctl process 安装 Istio 时, istio-sidecar-injector服务目标端口 9443而不是 443 :
~ $ kubectl get svc istio-sidecar-injector -n istio-system -o jsonpath="{.spec.ports[0]}"
map[port:443 protocol:TCP targetPort:9443]
master 上默认未打开此端口防火墙规则,并且是尝试部署资源时超时错误的原因,例如:
$ kubectl run -i --tty busybox --image=busybox --restart=Never -- sh
Error from server (InternalError): Internal error occurred: failed calling webhook "sidecar-injector.istio.io": Post https://istio-sidecar-injector.istio-system.svc:443/inject?timeout=30s: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

安装 Istio 后,我打开了端口 9443在防火墙上是这样的:
VPC_PROJECT=<project containing VPC network>
CLUSTER_NAME=<name of the GKE cluster>

FIREWALL_RULE_NAME=$(gcloud compute firewall-rules list --project $VPC_PROJECT --filter="name~gke-$CLUSTER_NAME-[0-9a-z]*-master" --format="value(name)")
gcloud compute firewall-rules update $FIREWALL_RULE_NAME --project $VPC_PROJECT --allow tcp:10250,tcp:443,tcp:9443

然后我能够毫无错误地创建资源:
$ kubectl run -i --tty busybox --image=busybox --restart=Never -- sh
If you don't see a command prompt, try pressing enter.
/ # ls
bin dev etc home proc root sys tmp usr var
/ #

关于kubernetes - 使用 istioctl 安装时在 Istio 1.4.0 中创建资源时超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59141732/

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