istio 配置
俗子
·
2024-05-29
·
via 俗子
Istio 服务网格
Istio 使用功能强大的 Envoy 服务代理扩展了 Kubernetes,以建立一个可编程的、可感知的应用程序网络。 Istio 与 Kubernetes 和传统工作负载一起使用,为复杂的部署带来了标准的通用流量管理、遥测和安全性。
安装
1
| curl -L https://istio.io/downloadIstio | sh -
|
真实 ip 转发
生成环境不建议
1
| kubectl patch svc istio-ingressgateway -n istio-system -p '{"spec":{"externalTrafficPolicy":"Local"}}'
|
HTTP/HTTPS 负载均衡
1 2 3 4 5 6 7
| apiVersion: install.istio.io/v1alpha1 kind: IstioOperator spec: meshConfig: defaultConfig: gatewayTopology: numTrustedProxies: 2
|
通过负载均衡器, 添加 ip 转发头
以 nginx 为例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| map $http_upgrade $connection_upgrade { default upgrade; '' close; }
server { listen 80 default_server; listen [::]:80 default_server;
server_name _;
location / { proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; proxy_pass http://192.168.3.161; } }
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。