OpenShift 4 - OpenShift Service Mesh 3 预览

OpenShift / RHEL / DevSecOps 汇总目录

了解 OpenShift Service Mesh 3 的变化

OpenShift Service Mesh 是一套在 OpenShift 上安装部署、跟踪监控 Istio 运行环境的实现。红帽在 2023 年底推出了技术预览版的 OpenShift Service Mesh 3,它和目前的 OpenShift Service Mesh 2.x 有明显变化。这一变化体主要现在 OpenShift Service Mesh 3 将能直接使用社区的 Istio 实现,而 OpenShift Service Mesh 2.x 使用的是经红帽小幅改造的 Istio。这种改造带来的好处是让红帽版的 Istio 能更充分地融入整个 OpenShift 环境,但也随之带来两个问题:其一是即便小幅的改造也需要时间开发和测试,因此 OpenShift Service Mesh 2.x 不能及时使用最新版 Istio;其二是 OpenShift Service Mesh 2.x 可能和社区版会有微小差异,因此会有迁移成本和使用约束。

OpenShift Service Mesh 3 更加贴近 Istio 社区,它可以直接使用社区最新的 Istio,而和对其跟踪监控的功能集成是也通过 Istio 社区推荐的 Istio addon 实现的。

安装 OpenShift Service Mesh 3 核心环境

安装 Sail Operator

目前处于预留阶段的 OpenShift Service Mesh 3 是通过 Sail Operator 安装部署的。

  1. 使用默认配置安装 Sail Operator 即可。

创建 istio 环境

  1. 创建 istio-system 项目。
  2. 在 istio-system 中使用 Sail Operator 创建 istio 资源。
  3. 完成后确认 State: Healthy。
  4. 查看当前 istio 的版本
$ oc -n istio-system get istio
NAME      REVISIONS   READY   IN USE   ACTIVE REVISION   VERSION   AGE
default   1           1       1        Healthy           v1.21.0   4d15h

创建 istio-cni 环境

  1. 创建 istio-cni 项目。
  2. 在 istio-cni 中使用 Sail Operator 创建 istio-cni 资源。
  3. 完成后确认 State: Healthy。

安装 istioctl 客户端

$ curl -sL https://istio.io/downloadIstioctl | ISTIO_VERSION=1.21.0 sh -
$ export PATH=$HOME/.istioctl/bin:$PATH
$ istioctl version
client version: 1.21.0
control plane version: 1.21.0
data plane version: 1.21.0 (8 proxies)

部署 Istio 应用

  1. 创建项目,然后打标签以实现自动注入。
oc new-project bookinfo
oc label namespace bookinfo istio-injection=enabled
  1. 部署应用
$ oc apply -f https://raw.githubusercontent.com/istio/istio/release-1.21/samples/bookinfo/platform/kube/bookinfo.yaml -n bookinfo
service/details created
serviceaccount/bookinfo-details created
deployment.apps/details-v1 created
service/ratings created
serviceaccount/bookinfo-ratings created
deployment.apps/ratings-v1 created
service/reviews created
serviceaccount/bookinfo-reviews created
deployment.apps/reviews-v1 created
deployment.apps/reviews-v2 created
deployment.apps/reviews-v3 created
service/productpage created
serviceaccount/bookinfo-productpage created
deployment.apps/productpage-v1 created
  1. 创建应用级 ingress-gateway。
$ oc apply -f https://raw.githubusercontent.com/maistra/istio-operator/maistra-3.0/chart/samples/ingress-gateway.yaml -n bookinfo
service/istio-ingressgateway created
deployment.apps/istio-ingressgateway created
role.rbac.authorization.k8s.io/istio-ingressgateway-sds created
rolebinding.rbac.authorization.k8s.io/istio-ingressgateway-sds created
 
$ oc expose service istio-ingressgateway -n bookinfo
$ INGRESS_HOST=$(oc get route istio-ingressgateway -n bookinfo -o jsonpath='{.spec.host}')
  1. 将应用访问入口配置到 ingress-gateway。
$ oc apply -f https://raw.githubusercontent.com/istio/istio/master/samples/bookinfo/networking/bookinfo-gateway.yaml -n bookinfo
gateway.networking.istio.io/bookinfo-gateway created
virtualservice.networking.istio.io/bookinfo created
  1. 访问应用页面。
$ echo http://$INGRESS_HOST/productpage
$ curl http://$INGRESS_HOST/productpage

监控 Istio 运行环境和运行应用

安装 prometheus addon

  1. 安装 prometheus addon。
oc apply -f https://raw.githubusercontent.com/istio/istio/master/samples/addons/prometheus.yaml
oc expose service prometheus -n istio-system
oc get route prometheus -o jsonpath='{.spec.host}' -n istio-system

安装 grafana addon

  1. 安装 grafana addon。
oc apply -f https://raw.githubusercontent.com/istio/istio/master/samples/addons/grafana.yaml
oc expose service grafana -n istio-system
oc get route grafana -o jsonpath='{.spec.host}' -n istio-system
  1. 打开 grafana 控制台,查看 Istio Service Dashboard。
    在这里插入图片描述

安装 jaeger addon

  1. 安装 jaeger addon。
oc apply -f https://raw.githubusercontent.com/istio/istio/master/samples/addons/jaeger.yaml
oc expose service tracing -n istio-system
oc get route tracing -o jsonpath='{.spec.host}' -n istio-system
  1. 打开 jaeger 控制台,监控服务。
    在这里插入图片描述

安装 kiali addon

  1. 安装 kiali addon。
oc apply -f https://raw.githubusercontent.com/istio/istio/master/samples/addons/kiali.yaml
oc expose service kiali -n istio-system
oc get route kiali -o jsonpath='{.spec.host}' -n istio-system
  1. 打开 kiali 控制台,跟踪服务调用路径。
    在这里插入图片描述

参考

https://github.com/maistra/istio-operator/blob/maistra-3.0/bundle/README.md
https://www.redhat.com/en/blog/introducing-a-new-operator-for-istio-on-openshift
https://www.redhat.com/en/blog/red-hat-openshift-service-mesh-3-developer-preview-update
https://github.com/openshift-service-mesh/sail-operator

相关推荐

  1. Vue3实现word

    2024-06-08 16:10:02       23 阅读
  2. vue3 H5项目中实现PDF

    2024-06-08 16:10:02       57 阅读
  3. vue3+vite使用viewerjs实现图片

    2024-06-08 16:10:02       30 阅读
  4. vue3之基于el-image实现图片

    2024-06-08 16:10:02       28 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-06-08 16:10:02       91 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-06-08 16:10:02       97 阅读
  3. 在Django里面运行非项目文件

    2024-06-08 16:10:02       78 阅读
  4. Python语言-面向对象

    2024-06-08 16:10:02       88 阅读

热门阅读

  1. 链表逆序用哨兵位头节点

    2024-06-08 16:10:02       33 阅读
  2. React+TS前台项目实战(三)-- 国际化配置

    2024-06-08 16:10:02       29 阅读
  3. 写在高考之际

    2024-06-08 16:10:02       30 阅读
  4. 数据处理 -- CRC32校验算法整理

    2024-06-08 16:10:02       24 阅读
  5. 什么是旋转多普勒效应?

    2024-06-08 16:10:02       23 阅读
  6. 03-3.2.4 双端队列

    2024-06-08 16:10:02       27 阅读
  7. 富格林:曝光纠正出金亏损陋习

    2024-06-08 16:10:02       31 阅读
  8. es6中箭头的用法

    2024-06-08 16:10:02       28 阅读
  9. linux shell脚本启动springboot服务

    2024-06-08 16:10:02       28 阅读