kubernetes集群编排——istio

官网:https://istio.io/latest/zh/about/service-mesh/

部署

[root@k8s2 ~]# tar zxf istio-1.19.3-linux-amd64.tar.gz
[root@k8s2 ~]# cd istio-1.19.3/

[root@k8s2 istio-1.19.3]# export PATH=$PWD/bin:$PATH

demo专为测试准备的功能集合

[root@k8s2 istio-1.19.3]# istioctl install --set profile=demo -y

[root@k8s2 istio-1.19.3]# kubectl get pod -A

给命名空间添加标签,指示 Istio 在部署应用的时候,自动注入 Envoy 边车代理

[root@k8s2 istio-1.19.3]# kubectl label namespace default istio-injection=enabled

部署示例应用

[root@k8s2 istio-1.19.3]# kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml

[root@k8s2 istio-1.19.3]# kubectl get pod

创建 Istio 入站网关

[root@k8s2 istio-1.19.3]# kubectl apply -f samples/bookinfo/networking/bookinfo-gateway.yaml

[root@k8s2 istio-1.19.3]# kubectl -n istio-system get svc

访问应用:http://192.168.92.102/productpage

部署遥测组件

[root@k8s2 istio-1.17.1]# kubectl apply -f samples/addons

待插件部署完毕后,修改kiali服务的访问方式为Loadbalancer

访问kiali:http://192.168.56.100:20001/

流量管理

将所有流量路由到每个微服务的 v1 版本

[root@k8s2 istio-1.19.3]# kubectl apply -f samples/bookinfo/networking/destination-rule-all.yaml

[root@k8s2 istio-1.19.3]# kubectl apply -f samples/bookinfo/networking/virtual-service-all-v1.yaml

来自名为 Jason 的用户的所有流量将被路由到服务 reviews:v2

[root@k8s2 istio-1.19.3]# kubectl apply -f samples/bookinfo/networking/virtual-service-reviews-test-v2.yaml

创建故障注入规则以延迟来自测试用户 jason 的流量

[root@k8s2 istio-1.19.3]# kubectl apply -f samples/bookinfo/networking/virtual-service-ratings-test-delay.yaml

用户 jason 登陆到 /productpage 页面,出现了一个问题:Reviews 部分显示了错误消息

设置流量转移,将所有流量转移到 reviews:v3

[root@k8s2 istio-1.19.3]# vim  samples/bookinfo/networking/virtual-service-reviews-test-v2.yaml
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: reviews
spec:
  hosts:
    - reviews
  http:
  - match:
    - headers:
        end-user:
          exact: jason
    route:
    - destination:
        host: reviews
        subset: v3
  - route:
    - destination:
        host: reviews
        subset: v1

[root@k8s2 istio-1.19.3]# kubectl apply -f samples/bookinfo/networking/virtual-service-reviews-test-v2.yaml

修改延迟规则为任何低于 2.5 秒的数值,例如 2 秒

[root@k8s2 istio-1.19.3]# vim  samples/bookinfo/networking/virtual-service-ratings-test-delay.yaml
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: ratings
spec:
  hosts:
  - ratings
  http:
  - match:
    - headers:
        end-user:
          exact: jason
    fault:
      delay:
        percentage:
          value: 100.0
        fixedDelay: 2s
    route:
    - destination:
        host: ratings
        subset: v1
  - route:
    - destination:
        host: ratings
        subset: v1

[root@k8s2 istio-1.19.3]# kubectl apply -f samples/bookinfo/networking/virtual-service-ratings-test-delay.yaml

把 50% 的流量从 reviews:v1 转移到 reviews:v3

[root@k8s2 istio-1.19.3]# kubectl apply -f samples/bookinfo/networking/virtual-service-reviews-50-v3.yaml

当reviews:v3 微服务已经稳定,可以通过应用 Virtual Service 规则将 100% 的流量路由 reviews:v3:

[root@k8s2 istio-1.19.3]# kubectl apply -f samples/bookinfo/networking/virtual-service-reviews-v3.yaml

清理

[root@k8s2 istio-1.19.3]# samples/bookinfo/platform/kube/cleanup.sh

熔断

部署 httpbin 服务

[root@k8s2 istio-1.19.3]# kubectl apply -f samples/httpbin/httpbin.yaml

配置熔断规则

[root@k8s2 istio-1.19.3]# kubectl apply -f - <<EOF
> apiVersion: networking.istio.io/v1alpha3
> kind: DestinationRule
> metadata:
>   name: httpbin
> spec:
>   host: httpbin
>   trafficPolicy:
>     connectionPool:
>       tcp:
>         maxConnections: 1
>       http:
>         http1MaxPendingRequests: 1
>         maxRequestsPerConnection: 1
>     outlierDetection:
>       consecutive5xxErrors: 1
>       interval: 1s
>       baseEjectionTime: 3m
>       maxEjectionPercent: 100
> EOF

增加一个客户端

[root@k8s2 istio-1.19.3]# kubectl apply -f samples/httpbin/sample-client/fortio-deploy.yaml

[root@k8s2 istio-1.19.3]# kubectl get pod

[root@k8s2 istio-1.19.3]# kubectl get svc

登入客户端 Pod 并使用 Fortio 工具调用 httpbin 服务

[root@k8s2 istio-1.19.3]# export FORTIO_POD=$(kubectl get pods -l app=fortio -o 'jsonpath={.items[0].metadata.name}')


[root@k8s2 istio-1.19.3]# kubectl exec "$FORTIO_POD" -c fortio -- /usr/bin/fortio curl -quiet http://httpbin:8000/get

触发熔断器

发送并发数为 2 的连接(-c 2),请求 20 次(-n 20)

[root@k8s2 istio-1.19.3]# kubectl exec "$FORTIO_POD" -c fortio -- /usr/bin/fortio load -c 2 -qps 0 -n 20 -loglevel Warning http://httpbin:8000/get

istio-proxy 确实允许存在一些误差

将并发连接数提高到 3 个

[root@k8s2 istio-1.19.3]# kubectl exec "$FORTIO_POD" -c fortio -- /usr/bin/fortio load -c 3 -qps 0 -n 30 -loglevel Warning http://httpbin:8000/get

将并发连接数提高到 5 个

[root@k8s2 istio-1.19.3]# kubectl exec "$FORTIO_POD" -c fortio -- /usr/bin/fortio load -c 5 -qps 0 -n 30 -loglevel Warning http://httpbin:8000/get

均被熔断器拦截

清理

[root@k8s2 istio-1.19.3]# kubectl delete destinationrule httpbin

[root@k8s2 istio-1.19.3]# kubectl delete -f samples/httpbin/sample-client/fortio-deploy.yaml

[root@k8s2 istio-1.19.3]# kubectl delete -f samples/httpbin/httpbin.yaml

卸载istio

[root@k8s2 istio-1.19.3]# istioctl uninstall -y --purge

[root@k8s2 istio-1.19.3]# kubectl label namespace default istio-injection-

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/149692.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

k8s-集群升级 2

在每个集群节点都安装部署cir-docker 配置cri-docker 升级master节点 导入镜像到本地并将其上传到仓库 修改节点套接字 升级kubelet 注&#xff1a;先腾空后进行升级&#xff0c;顺序不能搞反&#xff0c;否则会导致严重问题 配置kubelet使用cri-docker 解除节点保护 升级wor…

深度学习100例-卷积神经网络(CNN)实现mnist手写数字识别 | 第1天

文章目录 前期工作1. 设置GPU&#xff08;如果使用的是CPU可以忽略这步&#xff09;我的环境&#xff1a; 2. 导入数据3.归一化4.可视化5.调整图片格式 二、构建CNN网络模型三、编译模型四、训练模型五、预测六、知识点详解1. MNIST手写数字数据集介绍2. 神经网络程序说明3. 网…

汽车FMCW毫米波雷达信号处理流程(推荐---基础详细---清楚的讲解了雷达的过程---强烈推荐)------假设每个Chirp采集M个样本点

毫米波雷达在进行多目标检测时,TX发射一个Chirp,在不同距离下RX会接收到多个反射Chirp信号(仅以单个chirp为例)。 雷达通过接收不同物体的发射信号,并转为IF信号,利用傅里叶变换将产生一个具有不同的分离峰值的频谱,每个峰值表示在特定距离处存在物体。 请问,这种多目标…

电脑检测温度软件有哪些?

环境&#xff1a; Win10 专业版 问题描述&#xff1a; 电脑检测温度软件有哪些&#xff1f; 解决方案&#xff1a; 有很多电脑检测温度的软件可供选择&#xff0c;以下是一些常用的电脑温度监测工具&#xff1a; HWMonitor&#xff1a;一款免费的硬件监控软件&#xff0…

M系列 Mac使用Homebrew下载配置git和连接GitHub

一、首先我们需要安装Homebrew M系列 Mac安装配置Homebrewhttps://blog.csdn.net/W_Fe5/article/details/134428377?spm1001.2014.3001.5501 二、下载git 1、终端输入一下命令 brew install git 2、这时下载完成 二、配置git 1、创建用户名和邮箱 这里以我自己的邮箱举例…

2013年12月1日 Go生态洞察:Go 1.2版本发布

&#x1f337;&#x1f341; 博主猫头虎&#xff08;&#x1f405;&#x1f43e;&#xff09;带您 Go to New World✨&#x1f341; &#x1f984; 博客首页——&#x1f405;&#x1f43e;猫头虎的博客&#x1f390; &#x1f433; 《面试题大全专栏》 &#x1f995; 文章图文…

01背包 D. Make Them Equal

Problem - D - Codeforces 输出值不超过k次操作后的最大值。 看b数组的大小&#xff0c;b数组元素是小于1000的正整数。从1到bi如果可以&#xff0c;那么最多是大概10次的&#xff0c;因为是指数递增的&#xff0c;例如&#xff1a;1 -> 2 -> 4 -> 8 -> 16 -> …

Promise 重写 (第一部分)

学习关键语句&#xff1a; promise 重写 写在前面 重新学习了怎么重写 promise &#xff0c; 我觉得最重要的就是要有思路&#xff0c;不然有些 A 规范是完全想不到的 开始 重写函数的过程中, 最重要的是有思路 我们从哪里获取重写思路? 从正常的代码中 我们先看正常的代码…

高阶智驾必上「激光雷达」,一场车企的集体投票

‍作者 | 张祥威 编辑 | 德新 2023年尾上市的这一批车型中&#xff0c;以问界新M7、理想MEGA、小鹏X9、智界S7和极氪007最为典型&#xff0c;它们的头顶大多搭载了一颗激光雷达&#xff0c;有的车型比如小鹏X9&#xff0c;甚至在前大灯位置配置了两颗激光雷达。 这是为实现高…

谷粒商城项目-环境配置

安装vegrant 2.2.18 注意vritual box&#xff08;6.1.30&#xff09;和vegrant版本兼容 初始化和创建虚拟机 vagrant init centos/7 vagrant up连接虚拟机 vegrant ssh解决vagrant up速度过慢问题 https://app.vagrantup.com/centos/boxes/7/versions/2004.01直接下载对应镜像…

零基础学会酒店预订小程序制作

" 如果你想要开发一个酒店预订小程序&#xff0c;以下是一个简单的步骤指南&#xff0c;帮助你通过第三方制作平台/工具如乔拓云网来实现这一目标&#xff1a; 1. 找一个合适的第三方制作平台/工具&#xff1a; 在如今的市场上&#xff0c;有许多第三方制作平台/工具可供选…

Java中的继承

文章目录 前言一、为什么需要继承二、继承的概念三、继承的语法四、父类成员访问4.1子类中访问父类的成员变量1.子类和父类不存在同名成员变量2.子类和父类成员变量同名 4.2子类中访问父类的成员方法1.成员方法名字不同2.成员方法&#xff0c;名字相同 五、super和this关键字六…

场景图形管理 - (2)

裁剪平面示例(二) 裁剪平面(osg::Scissor)示例(二)的代码如程序清单8-2所示 // 裁剪平面测试&#xff08;2&#xff09; void scissor_8_2(const string strDataFolder) { osg::ref_ptr<osgViewer::Viewer> viewer new osgViewer::Viewer(); osg::ref_ptr<osg::Gra…

FPGA电平标准的介绍

对FPGA的管脚进行约束的时候&#xff0c;常常看到这样的电平标准&#xff0c;例如LVCOM18&#xff0c;LVCOS25&#xff0c;LVDS&#xff0c;LVDS25等等&#xff0c;其实这些都是一系列的电平标准。 针对数字电路而言&#xff0c;数字电路表示电平的只有1和0两个状态&#xff0c…

11.15 知识总结(模板层、模型层)

一、 模板层 1.1 过滤器 1.什么是过滤器&#xff1f; 过滤器类似于python的内置函数&#xff0c;用来把变量值加以修饰后再显示。 2. 语法 1、 {{ 变量名|过滤器名 }} 2、链式调用&#xff1a;上一个过滤器的结果继续被下一个过滤器处理 {{ 变量名|过滤器1|过滤器2 }} 3、有的过…

栈与队列:用队列实现栈

目录 题目&#xff1a; 栈和队列的数据模型对比&#xff1a; 思路分析&#xff1a; 代码分析&#xff1a; 一、定义栈 二、初始化栈 三、入栈 四、出栈⭐ 代码解析&#xff1a; 五、获取栈顶元素 六、 判断栈是否为空 七、销毁栈 完整代码&#xff1a; 需…

在webstorm中配置sass编译环境

1.下载ruby 下载地址&#xff1a;ruby下载 2.安装ruby 下载之后&#xff0c;有一个exe安装包 双击exe文件 &#xff0c;并选择自己的安装位置&#xff08;这个位置一定要记得&#xff0c;需要在webstorm中使用&#xff09;。其他的步骤默认安装即可。 3.安装sass ruby安装成功后…

记feign调用第三方接口时header是multipart/form-data

1.请求第三方接口&#xff0c;用feign请求 请求第三方接口&#xff0c;用feign请求&#xff0c;header不通&#xff0c;feign的写法不同 调用时报错Could not write request: no suitable HttpMessageConverter found for request type [com.ccreate.cnpc.mall.dto.zm.ZMPage…

程序员的护城河:技术深度、创新精神与软实力的完美结合

文章目录 1. 技术深度&#xff1a;建立坚实的技术基石2. 创新精神&#xff1a;应对变革的利器3. 软实力&#xff1a;沟通协作构筑团队防线4. 结合三者构筑完美护城河 &#x1f389;程序员的护城河&#xff1a;技术深度、创新精神与软实力的完美结合 ☆* o(≧▽≦)o *☆嗨~我是I…

【Maven】进阶

文章目录 1. 聚合2. 继承3. 属性变量定义与使用4. 版本管理5. 资源配置6. 多环境配置7. 跳过测试&#xff08;了解&#xff09; 1. 聚合 为了防止某个模块&#xff08;dao&#xff09;更新了&#xff0c;重新编译了&#xff0c;导致和其他模块不兼容&#xff0c;需要用一个roo…
最新文章