You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Istio VirtualService未将100%流量路由至nginx-v2的问题求助

Istio VirtualService未将100%流量路由至nginx-v2的问题求助

大家好,我刚上手Istio来管理我的Nginx应用流量,现在想实现100%流量路由到nginx-v2,0%流向nginx-v1的目标,但操作后没达到预期效果,想请各位帮忙排查问题。

以下是我使用的deployments.yaml配置(注:nginx-v2的配置内容输入时出现截断,实际我配置里的matchLabels和Pod模板labels都正确设置了version: v2,容器镜像为quay.io/shardul/nginx:v2):

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: nginx
  name: nginx-v1
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
      version: v1
  template:
    metadata:
      labels:
        app: nginx
        version: v1
    spec:
      containers:
        - image: quay.io/shardul/nginx:v1
          name: nginx-v1
          ports:
            - name: http
              containerPort: 80
          livenessProbe:
            httpGet:
              path: /health
              port: 80
          readinessProbe:
            httpGet:
              path: /health
              port: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: nginx
  name: nginx-v2
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
      versi...

我已经执行kubectl apply -f deployments.yaml完成部署,同时也创建了对应的Kubernetes Service,以及Istio的VirtualService和DestinationRule来配置全量路由到v2的规则。但测试下来,还是能访问到nginx-v1的实例,流量没有完全切换到v2。我尝试过重新应用Istio配置、重启相关Pod,但问题依旧。

有没有大佬能帮我分析下可能的原因?或者是不是我在路由规则配置上有什么遗漏或错误?麻烦大家了!

备注:内容来源于stack exchange,提问作者Typewriter

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.15 11:23:03