
我正在新的 AWS EKS 叢集中設定 Istio,並建立了一個基本的 nginx 部署來測試。當部署只有一個副本時,它可以完美運行,響應時間不到 100 毫秒。當我新增一個副本時,新 Pod 的回應時間瘋狂增加,平均約為 10 秒。
根據其他地方的建議,我更新了網格配置停用自動重試:
meshConfig:
defaultHttpRetryPolicy: {}
發生這種情況後,我發現第二個 pod 的請求總是失敗:
"GET / HTTP/1.1" 503 UF upstream_reset_before_response_started{connection_failure} - "-" 0 91 10003 - "108.249.9.111,10.1.0.117" "curl/7.68.0" "6fa51be8-1441-4454-8d 1b-a03c93b257dc" "example.com" "10.1.52.62:80" outbound|80||nginx.my-namespace.svc.cluster.local - 10.1.108.189:8080 10.1.0.117:21410 - -
我的設定如下:
# AWS ALB Ingress -> istio-ingressgateway (ClusterIP) -> gateway -> virtualservice -> service -> nginx
apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
name: default
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "*"
---
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: nginx
spec:
hosts:
- "example.com"
gateways:
- default
http:
- route:
- destination:
host: nginx
---
apiVersion: v1
kind: Service
metadata:
name: nginx
labels:
app: nginx
spec:
selector:
app: nginx
ports:
- port: 80
name: http
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
labels:
app: nginx
version: v1
spec:
replicas: 2
revisionHistoryLimit: 1
selector:
matchLabels:
app: nginx
version: v1
template:
metadata:
labels:
app: nginx
version: v1
spec:
containers:
- name: nginx
image: nginx:latest
ports:
- containerPort: 80
resources:
requests:
memory: 100Mi
cpu: 100m
limits:
memory: 1500Mi
cpu: 1000m
版本:
$ istioctl version
client version: 1.13.2
control plane version: 1.13.2
data plane version: 1.13.2 (1 proxies)
$ kubectl version --short
Client Version: v1.21.11
Server Version: v1.21.5-eks-bc4871b
答案1
我發現我的問題是由於節點的安全群組規則配置錯誤造成的。我不允許節點到節點的流量,從而阻止 istio 入口網關與其他節點中的 pod 進行通訊。
使用 AWS EKS Terraform 模組,我新增了以下內容:
node_security_group_additional_rules = {
ingress_self_all = {
description = "Node to node all ports/protocols"
protocol = "-1"
from_port = 0
to_port = 0
type = "ingress"
self = true
}
egress_all = {
description = "Node all egress"
protocol = "-1"
from_port = 0
to_port = 0
type = "egress"
cidr_blocks = ["0.0.0.0/0"]
}
}