Istio 流量管理:示例一

发布时间: 更新时间: 总字数:1877 阅读时间:4m 作者:IP:上海 网址

Istio的流量管理示例一:VirtualService和流量负载均衡。

介绍

更多示例,建议参考:https://istio.io/latest/docs/examples/

示例文件

  • site1-demo.yaml
site1 ...
  • site2-demo.yaml
site2 ...
  • site-svc-demo.yaml
site-svc ...
  • site-istio-vs-demo.yaml
site-istio-vs-demo ...
  • site-client-demo.yaml
site-client-demo ...

创建资源

crate-resource ...

示例

示例一:原生svc负载

参考kube-dns/CoreDNS 实现介绍配置master host

  • 在master上访问,流量是各 50% 的:
demo-1 ...
  • 在容器内访问,流量是各 50% 的:
demo-2 ...

示例二:istio注入

  • 注入
istio-injection ...
  • master 节点访问,在未注入istio的容器内访问,流量比为1:1
  • 对 client 注入 istio,然后在容器内访问,流量均为 4:1
    • 必须是在注入 istio 的容器内通过(dns or ip)访问virtual services,流量都是 80:20
demo-3 ...

istioctl 问题排查命令

查看 envoy 代理配置查看命令:

$ istioctl proxy-config -h
...
Available Commands:
  all            Retrieves all configuration for the Envoy in the specified pod
  bootstrap      Retrieves bootstrap configuration for the Envoy in the specified pod
  cluster        Retrieves cluster configuration for the Envoy in the specified pod
  endpoint       Retrieves endpoint configuration for the Envoy in the specified pod
  listener       Retrieves listener configuration for the Envoy in the specified pod
  log            (experimental) Retrieves logging levels of the Envoy in the specified pod
  rootca-compare Compare ROOTCA values for the two given pods
  route          Retrieves route configuration for the Envoy in the specified pod
  secret         Retrieves secret configuration for the Envoy in the specified pod
...

查看代理 all 情况

demo-istioctl-proxy-config-all ...

查看 endpoint 情况

  • istioctl proxy-config endpoint <pod-name>
demo-istioctl-proxy-config-endpoint ...

查看 cluster 情况

  • istioctl proxy-config cluster <pod-name>
demo-istioctl-proxy-config-cluster ...

查看 route 情况

demo-istioctl-proxy-config-route ...
本文总阅读量 次 本站总访问量 次 本站总访客数