kubernetes - Kubernetes/EKS 滚动更新导致停机
问题描述
我们为部署到 EKS 的服务有以下配置,但每当我们进行部署时,它都会导致大约 120 秒的停机时间。
当我直接转发到新 pod 时,我可以成功地向它发出请求,因此 pod 本身看起来很好。似乎是没有路由流量的 AWS NLB 或与网络相关的东西,但我不确定,我不知道在哪里进一步调试。
我尝试了几件事无济于事:添加 a readinessProbe
,尝试增加initialDelaySeconds
to 120
,尝试切换到IP
ELB 目标,而不是instance
ELB 目标类型,尝试减少 NLB 的健康检查间隔,但实际上并没有被应用,并且保持为 30 秒。
任何帮助将不胜感激!
---
# Autoscaler for the frontend
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: my-frontend
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: my-frontend
minReplicas: 3
maxReplicas: 8
targetCPUUtilizationPercentage: 60
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-frontend
labels:
app: my-frontend
spec:
replicas: 3
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
type: RollingUpdate
selector:
matchLabels:
app: my-frontend
template:
metadata:
labels:
app: my-frontend
spec:
containers:
- name: my-frontend
image: ${DOCKER_IMAGE}
ports:
- containerPort: 3001
name: web
resources:
requests:
cpu: "300m"
memory: "256Mi"
livenessProbe:
httpGet:
scheme: HTTP
path: /v1/ping
port: 3001
initialDelaySeconds: 5
timeoutSeconds: 1
periodSeconds: 10
readinessProbe:
httpGet:
scheme: HTTP
path: /v1/ping
port: 3001
initialDelaySeconds: 5
timeoutSeconds: 1
periodSeconds: 10
restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
annotations:
service.beta.kubernetes.io/aws-load-balancer-type: nlb
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: http
service.beta.kubernetes.io/aws-load-balancer-ssl-cert: ${SSL_CERTIFICATE_ARN}
service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "https"
service.beta.kubernetes.io/aws-load-balancer-cross-zone-load-balancing-enabled: "true"
service.beta.kubernetes.io/aws-load-balancer-healthcheck-interval: "10"
service.beta.kubernetes.io/aws-load-balancer-connection-draining-enabled: "true"
service.beta.kubernetes.io/aws-load-balancer-connection-draining-timeout: "60"
name: my-frontend
labels:
service: my-frontend
spec:
ports:
- name: http
port: 80
targetPort: 3001
- name: https
port: 443
targetPort: 3001
externalTrafficPolicy: Local
selector:
app: my-frontend
type: LoadBalancer
解决方案
推荐阅读
- chart.js - 在向左平移的折线图中加载更多历史数据
- java - 我必须解析 JSON 响应,我必须获取 leet speak 下的子节点(包含符号、字符、数字的随机字符串)
- node.js - 如何在 node.js (IIS) 中获取我的 Web 应用程序的物理路径
- angular - Angular:如何使用导航方法从父组件导航到子路由
- linux - 如何使用介子设置 googletest?
- wordpress - 我在插件的帮助下将 LDAP AD 添加到 WP,但是在 WP 中的 AD 更改后,我仍然有老用户
- python - 如何将网格转换为数据框中的 1 列并使其高效
- ios - 带有有效详细信息的 iOS 应用程序中的 Okta 身份验证失败
- kubernetes - 使用 Kubernetes 故障域进行灾难恢复
- angular - 输入角度时更改文本颜色