《istio-in-action 系列》 17. Gateway 支持 https 访问 - 标准模式

Gateway 支持 https 访问 - 标准模式 https://istio.io/latest/docs/reference/config/networking/gateway/#ServerTLSSettings credentialName: The secret (of type generic) should contain the following keys and values: key: <privateKey> and cert: <serverCert> 创建证书 k8s secret 在 标准模式 下, 必须使用 key 作为私钥文件名, cert 作为证书文件名。 证书文件需要 保持 与 istio-ingressgateway 服务在 相同 的命名空间。 因此证书文件的创建命令如下 1 2 3 4 kubectl create secret generic wild-tangx-in \ --from-file=key=./certificates/_.tangx.in.key \ --from-file=cert=./certificates/_.tangx.in.crt \ -n istio-system 其中 wild-tangx-in: 是 secret name。 之后 istio gateway 需要使用 ./certificates/_.tangx.in.key(crt) 是证书私钥/……

阅读全文

《istio-in-action 系列》 14. VirtualService Header 操作

VirtualService Header 操作 当 Envoy 在进行请求流量转发的时候, 还可以对消息 (request/response) 的 Header 进行操作。 set : 如果不存在, 则 创建 header, 如果存在, 则 覆盖 header 1 2 3 4 5 6 7 spec: http: - headers: request: set: key1: value1 key2: value2 add : 如果不存在, 则 新增; 如果村子啊, 则 追加 1 2 3 4 5 6 7 spec: http: - headers: request: add: key1: value1 key2: value2 remove: 如果存在, 则 删除 header; 不存在, 则 忽略 1 2 3 4 5 6 7 spec:……

阅读全文

《istio-in-action 系列》 13. VirtualService 服务委托

VirtualService 服务委托 服务委托就是流量转发。 https://istio.io/latest/docs/reference/config/networking/virtual-service/#Delegate 如下 VirtualService 的 流量委托 定义, 是在 myistio 这个命名空间中创建的。 但是将 myistio.tangx.in/prod 的流量转发到了命名空间 myistio-prod 中的 prod 服务中; 同样将 myistio.tangx.in/reviews 的流量转发到了命名空间 myistio-review 中的 review 服务中。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 # vs http delegate apiVersion: networking.istio.io/v1alpha3 kind: VirtualService metadata: name: vs-delegate namespace: myistio # 注意 namespace spec: gateways: - istio-tangx-in hosts: - istio.tangx.in http: - match: -……

阅读全文

《istio-in-action 系列》 12. VirtualService 混沌测试/错误注入

VirtualService 混沌测试/错误注入 在 Istio 中还实现了一个很重要的功能: 错误注入。 可以设置 一定几率 出现 延迟(delay) 和 中止(abort) 错误。 Http Fault Injection Delay 延迟 一定概率出现 缓慢 相应。 fixedDelay: 延迟时间。 格式 1h / 1m / 1s。 最小 1ms。 percentage: 错误触发几率。 0-100 之间。 可以为 double 类型的小数。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17……

阅读全文

《istio-in-action 系列》 11. VirtualService 重试机制

VirtualService 重试机制 在 Istio VirtualService 中, 有一个很关键的机制: 重试。 发起重试不需要业务本身实现, 而是 istio 通过 envoy 发起的。 其中有几个关键参数 attempts: 重试次数(不含初始请求), 即最大请求次数为 n+1。 perTryTimeout: 发起重试的间隔时间。 必须大于 1ms。 默认于 http route 中的 timeout 一致, 即无 timeout 时间 retryOn: 执行重试的触发条件。 条件值有 envoy 提供: https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/router_filter#x-envoy-retry-on http retry 1……

阅读全文

《istio-in-action 系列》 10. VirtualService 路由重定向

VirtualService 路由重定向 在 VirtualService 配置中, 除了 http rewrite 路由重写之外, 还有 http redirect 路由重定向。 即常说的 30x。 https://istio.io/latest/docs/reference/config/networking/virtual-service/#HTTPRedirect http redirect VirtualService 重定向配置如下。 有三个重要参数 uri: 重定向后的 uri redirectCode: 重定向时的 http response code。 ex: 301, 302。 默认值为 301 。 authority: 重定向后的 http host。 即 http response header 中的 location 字段。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 --- apiVersion: networking.istio.io/v1alpha3 kind: VirtualService metadata:……

阅读全文

《istio-in-action 系列》 1. 安装 docker-k3s-istio 开发环境

升级项目 之前的项目中只有 prod 服务,具有版本的区分。 现在对项目进行一些升级, 模拟一个多服务的项目。 两个服务, review / prod 服务之前还有调用关系。 prod -> review review 这次新加入了 review 评论服务。 { "1": { "id": "1", "name": "zhangsan", "commment": "istio 功能很强大, 就是配置太麻烦" }, "2": { "id": "1", "name": "wangwu", "commment": "《istio in action》 真是一本……

阅读全文

《istio-in-action 系列》 1. 安装 docker-k3s-istio 开发环境

《istio-in-action系列》 1. 初始化第一个项目 项目代码在 https://github.com/tangx/istio-in-action 命令中有很多快捷键, 参考 install and prepare 1. 创建 namespace 并开启整体 istio 注入 这里已经使用了 alias 命令别名, 如果看不懂, 请参考第一篇 1.1 创建 namespace myistio 1 2 3 4 5 6 kc ns myistio namespace/myistio created kns myistio Context "default" modified. Active namespace is "myistio". 1.2 向 namespace 中开启 istio 注入 1 2 3 4 5 6 7 8 9 10 11 12 13 # 向 ns 加入标签……

阅读全文

《istio-in-action 系列》 1. 安装 docker-k3s-istio 开发环境

《istio-in-action 系列》 1. 安装 docker-k3s-istio 开发环境 1. 安装 docker 我这里使用的是 ubuntu20.04LTS 操作系统 1 2 sudo apt update sudo apt install docker-ce 配置 docker 加速仓库 1 2 3 4 5 6 7 { "registry-mirrors": [ "https://mirror.ccs.tencentyun.com", "https://wlzfs4t4.mirror.aliyuncs.com" ], "bip": "169.253.32.1/24" } 上述是腾讯云和阿里云的加速仓库, 根据需求自行调整。 完成配置后, 重启 docker 1 2 systemctl daemon-reload systemctl restart docker 2. 安装 k3s 2.1 安装 k3s k3s 使用 --docker 模式是为了方便 docker build 产生的……

阅读全文

福利派送

  • (免费星球)「运维成长路线」

  • 又拍云免费 CDN

最近文章

分类

标签

其它