Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/kubernetes/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Kubernetes 在istio 1.6中取消了控制标头和路由_Kubernetes_Istio - Fatal编程技术网

Kubernetes 在istio 1.6中取消了控制标头和路由

Kubernetes 在istio 1.6中取消了控制标头和路由,kubernetes,istio,Kubernetes,Istio,我需要使用istio根据标题路由流量,但在istio1.6版本中不推荐使用此选项。为什么在istio中不推荐使用控件头和路由?如istio中所述 Istio 1.5中不推荐使用混音器策略,不建议在生产中使用 考虑使用特使过滤器、过滤器,或使用编写过滤器 控制头和路由并没有被弃用,它只是用来做这件事的混合器。如上所述,现在有不同的方法可以做到这一点 我不确定你到底想做什么,但看看特使过滤器和虚拟服务 特使过滤器 有一个特使过滤器,它向所有出站响应添加一些自定义标题 kind: EnvoyFilt

我需要使用istio根据标题路由流量,但在istio1.6版本中不推荐使用此选项。为什么在istio中不推荐使用控件头和路由?

如istio中所述

Istio 1.5中不推荐使用混音器策略,不建议在生产中使用

考虑使用特使过滤器、过滤器,或使用编写过滤器

控制头和路由并没有被弃用,它只是用来做这件事的混合器。如上所述,现在有不同的方法可以做到这一点

我不确定你到底想做什么,但看看特使过滤器和虚拟服务


特使过滤器 有一个特使过滤器,它向所有出站响应添加一些自定义标题

kind: EnvoyFilter
metadata:
  name: lua-filter
  namespace: istio-system
spec:
  workloadSelector:
    labels:
      istio: ingressgateway
  configPatches:
  - applyTo: HTTP_FILTER
    match:
      context: GATEWAY
      listener:
        filterChain:
          filter:
            name: "envoy.http_connection_manager"
            subFilter:
              name: "envoy.router"
    patch:
      operation: INSERT_BEFORE
      value:
       name: envoy.lua
       typed_config:
         "@type": "type.googleapis.com/envoy.config.filter.http.lua.v2.Lua"
         inlineCode: |
            function envoy_on_response(response_handle)
                response_handle:logInfo(" ========= XXXXX ========== ")
                response_handle:headers():add("X-User-Header", "worked")
            end
和来自curl的测试

$ curl -s -I -X HEAD x.x.x.x/
HTTP/1.1 200 OK
server: istio-envoy
date: Mon, 06 Jul 2020 08:35:37 GMT
content-type: text/html
content-length: 13
last-modified: Thu, 02 Jul 2020 12:11:16 GMT
etag: "5efdcee4-d"
accept-ranges: bytes
x-envoy-upstream-service-time: 2
x-user-header: worked
以下几个链接值得检查:


虚拟服务 这里值得检查的另一件事是,您可以根据这里的匹配进行头路由

让我们看一看下面的例子

HttpMatchRequest指定要满足的一组标准,以便将规则应用于HTTP请求。例如,以下限制规则仅匹配URL路径以/ratings/v2/开头的请求,并且请求包含值为jason的自定义最终用户标头。

此外,在虚拟服务中还有my older和基于标头的路由


如果您还有任何问题,请告诉我。

如istio中所述

Istio 1.5中不推荐使用混音器策略,不建议在生产中使用

考虑使用特使过滤器、过滤器,或使用编写过滤器

控制头和路由并没有被弃用,它只是用来做这件事的混合器。如上所述,现在有不同的方法可以做到这一点

我不确定你到底想做什么,但看看特使过滤器和虚拟服务


特使过滤器 有一个特使过滤器,它向所有出站响应添加一些自定义标题

kind: EnvoyFilter
metadata:
  name: lua-filter
  namespace: istio-system
spec:
  workloadSelector:
    labels:
      istio: ingressgateway
  configPatches:
  - applyTo: HTTP_FILTER
    match:
      context: GATEWAY
      listener:
        filterChain:
          filter:
            name: "envoy.http_connection_manager"
            subFilter:
              name: "envoy.router"
    patch:
      operation: INSERT_BEFORE
      value:
       name: envoy.lua
       typed_config:
         "@type": "type.googleapis.com/envoy.config.filter.http.lua.v2.Lua"
         inlineCode: |
            function envoy_on_response(response_handle)
                response_handle:logInfo(" ========= XXXXX ========== ")
                response_handle:headers():add("X-User-Header", "worked")
            end
和来自curl的测试

$ curl -s -I -X HEAD x.x.x.x/
HTTP/1.1 200 OK
server: istio-envoy
date: Mon, 06 Jul 2020 08:35:37 GMT
content-type: text/html
content-length: 13
last-modified: Thu, 02 Jul 2020 12:11:16 GMT
etag: "5efdcee4-d"
accept-ranges: bytes
x-envoy-upstream-service-time: 2
x-user-header: worked
以下几个链接值得检查:


虚拟服务 这里值得检查的另一件事是,您可以根据这里的匹配进行头路由

让我们看一看下面的例子

HttpMatchRequest指定要满足的一组标准,以便将规则应用于HTTP请求。例如,以下限制规则仅匹配URL路径以/ratings/v2/开头的请求,并且请求包含值为jason的自定义最终用户标头。

此外,在虚拟服务中还有my older和基于标头的路由



如果您还有任何问题,请告诉我。

您可以使用过滤器/策略适配器来处理标头和路由。您检查过了吗?您可以使用过滤器/策略适配器来处理标头和路由。你检查过了吗?