Istio虚拟服务未应用超时

时间:2019-02-26 08:39:16

标签: kubernetes istio

我想使用Istio的故障注入机制。

我一直在为服务添加5秒钟的超时任务。因此,为了实现这一点,我制作了自己的虚拟服务,如下:

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: hello
  namespace: default
spec:
  hosts:
  - hello-service.default.svc.cluster.local
  http:
  - fault:
      delay:
        percent: 100   #Applies on all request
        fixedDelay: 5s #Timeout of 5 sec
    route:
    - destination:
        host: hello-service.default.svc.cluster.local

如您所见,我只重定向了hello服务本身,并应用了5秒超时。 不幸的是,超时根本不起作用...


这是documentation中的示例:

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: ratings
spec:
  hosts:
  - ratings
  http:
  - fault:
      delay:
        percent: 100
        fixedDelay: 2s
    route:
    - destination:
        host: ratings
        subset: v1

我做错了什么?
感谢您的帮助


更新1-添加目标服务

apiVersion: v1
kind: Service
metadata:
  name: hello-service
  namespace: default
spec:
  selector:
    app: hello
  ports:
  - port: 80
    targetPort: 9080

更新2-添加proxy-config的输出

$istioctl proxy-config route hello-75c874b67f-6l4p9
NOTE: This output only contains routes loaded via RDS.
NAME      VIRTUAL HOSTS
80        6
3000      4
8060      1
8080      2
8088      1
9090      1
9091      2
9093      5
9411      1
15004     2
15010     1
15030     1
15031     1
20001     1
          1

1 个答案:

答案 0 :(得分:0)

添加此答案以深入了解问题的状态。

借助@Sergii Bishyr,我现在知道问题中提供的virtualService正在运行。

我用两个简单的应用程序(从第一个滚动到第二个)进行了测试。在这种情况下,将应用超时!

不幸的是,在我使用虚拟服务的原始应用程序上,它仍然无法正常工作。

测试应用程序 原始应用程序都是网络服务器,因此我不确定为什么在某些情况下它可以工作,而在第二个...这个谜还没有解决。

相关问题