Kubernetes 与istioctl一起安装时,在Istio 1.4.0中创建资源时超时

Kubernetes 与istioctl一起安装时,在Istio 1.4.0中创建资源时超时,kubernetes,google-kubernetes-engine,istio,Kubernetes,Google Kubernetes Engine,Istio,我正在尝试在新的GKE集群上安装Istio 1.4.0。当我使用Helm安装过程时,Istio工作正常,我可以应用自己的资源(网关、部署等),而不会出现任何问题,例如: # Create namespace kubectl create namespace istio-system # Install Istio CRDs helm template install/kubernetes/helm/istio-init --name istio-init --namespace istio-s

我正在尝试在新的GKE集群上安装Istio 1.4.0。当我使用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 -
但是,当我尝试使用该过程安装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
我尝试创建的每种类型的资源都会发生这种情况。有没有其他人经历过类似的事情,或者知道潜在的问题是什么

运行不会暴露任何问题:

$ 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:

curl -L https://istio.io/downloadIstio | sh -
cd istio-1.*
export PATH=$PWD/bin:$PATH
istioctl manifest apply
然后,我可以运行此命令,并成功完成:

kubectl run -i --tty busybox --image=busybox --restart=Never -- sh

我明白了。问题在于
istio sidecar injector
服务,我使用的是私有GKE集群,它比非私有集群具有更严格的默认防火墙规则

通过安装Istio时,Istio侧车喷油器的维修目标端口
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]
~ $ kubectl get svc istio-sidecar-injector -n istio-system -o jsonpath="{.spec.ports[0]}"
map[port:443 protocol:TCP targetPort:9443]
端口
443
master
防火墙规则上默认打开(例如
gke--XXXXXXXX-master
),因此
istio侧车喷油器可以成功工作

但是,当通过新的安装Istio时,
Istio侧车喷油器
服务的目标端口是
9443
,而不是
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]
~ $ kubectl get svc istio-sidecar-injector -n istio-system -o jsonpath="{.spec.ports[0]}"
map[port:443 protocol:TCP targetPort:9443]
默认情况下,
主机
防火墙规则不会打开此端口,这是尝试部署资源时超时错误的原因,例如:

$ 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

这个命令对我来说失败了-我已经用错误消息编辑了我的问题。我正在使用带有自定义项的默认配置文件安装Istio,因此我假设是这些自定义项之一导致了问题。我创建了一个新群集,并按照上面的安装过程进行了安装。安装后,我能够运行busybox。但是,当我在默认名称空间(
kubectl label namespace default istio injection=enabled
)上启用
istio injection
时,我在编辑的问题中得到了相同的超时错误。