rootless模式下测试istio Ambient功能

devtools/2024/10/23 20:13:55/

前置需求

rootless k8s测试环境搭建:https://blog.csdn.net/longtds/article/details/142916697

istio_Ambient_3">istio Ambient

istio_4">istio安装

通过加速下载istio release包,解压并安装为ambient模式

 wget https://mirror.ghproxy.com/https://github.com/istio/istio/releases/download/1.23.2/istio-1.23.2-linux-amd64.tar.gztar xf istio-1.23.2-linux-amd64.tar.gzcd istio-1.23.2bin/istioctl install --set profile=ambient --skip-confirmation

istio__12">istio 插件安装

istio插件提供了多种可观测系统方案,这里仅仅使用最基础核心的部分

  • prometheus用于收集各种指标和遥测数据
  • grafana用于将prometheus中数据可视化
  • kiali用于服务网格可视化
# 部署插件
cd samples/addons/
kubectl apply -f prometheus.yaml -f kiali.yaml -f grafana.yaml# 查看istio-system pod运行情况
longtds@ubuntu:~$ kubectl get po -n istio-system
NAME                          READY   STATUS    RESTARTS   AGE
grafana-f459cd95-hm6cn        1/1     Running   0          36m
istio-cni-node-287rv          1/1     Running   0          49m
istio-cni-node-frwsn          1/1     Running   0          49m
istio-cni-node-mp5wc          1/1     Running   0          49m
istiod-6499566979-9zfcx       1/1     Running   0          49m
kiali-5bc5879b57-sfsk4        1/1     Running   0          36m
prometheus-84676b8788-qlsbr   2/2     Running   0          36m
ztunnel-2g5wn                 1/1     Running   0          48m
ztunnel-lvvm7                 1/1     Running   0          48m
ztunnel-m9jpw                 1/1     Running   0          48m# 验证istio安装
longtds@ubuntu:~$ istioctl verify-install
1 Istio control planes detected, checking --revision "default" only
✔ Deployment: istiod.istio-system checked successfully
✔ DaemonSet: istio-cni-node.istio-system checked successfully
✔ DaemonSet: ztunnel.istio-system checked successfully
✔ Service: istiod.istio-system checked successfully
✔ ConfigMap: istio.istio-system checked successfully
✔ ConfigMap: istio-cni-config.istio-system checked successfully
✔ ConfigMap: istio-sidecar-injector.istio-system checked successfully
✔ Pod: istiod-6499566979-9zfcx.istio-system checked successfully
✔ ServiceAccount: istio-cni.istio-system checked successfully
✔ ServiceAccount: istio-reader-service-account.istio-system checked successfully
✔ ServiceAccount: istiod.istio-system checked successfully
✔ ServiceAccount: ztunnel.istio-system checked successfully
✔ RoleBinding: istiod.istio-system checked successfully
✔ Role: istiod.istio-system checked successfully
✔ PodDisruptionBudget: istiod.istio-system checked successfully
✔ HorizontalPodAutoscaler: istiod.istio-system checked successfully
✔ MutatingWebhookConfiguration: istio-revision-tag-default.istio-system checked successfully
✔ MutatingWebhookConfiguration: istio-sidecar-injector.istio-system checked successfully
✔ ValidatingWebhookConfiguration: istio-validator-istio-system.istio-system checked successfully
✔ ValidatingWebhookConfiguration: istiod-default-validator.istio-system checked successfully
✔ ClusterRole: istio-cni.istio-system checked successfully
✔ ClusterRole: istio-cni-ambient.istio-system checked successfully
✔ ClusterRole: istio-cni-repair-role.istio-system checked successfully
✔ ClusterRole: istio-reader-clusterrole-istio-system.istio-system checked successfully
✔ ClusterRole: istiod-clusterrole-istio-system.istio-system checked successfully
✔ ClusterRole: istiod-gateway-controller-istio-system.istio-system checked successfully
✔ ClusterRoleBinding: istio-cni.istio-system checked successfully
✔ ClusterRoleBinding: istio-cni-ambient.istio-system checked successfully
✔ ClusterRoleBinding: istio-cni-repair-rolebinding.istio-system checked successfully
✔ ClusterRoleBinding: istio-reader-clusterrole-istio-system.istio-system checked successfully
✔ ClusterRoleBinding: istiod-clusterrole-istio-system.istio-system checked successfully
✔ ClusterRoleBinding: istiod-gateway-controller-istio-system.istio-system checked successfully
✔ CustomResourceDefinition: authorizationpolicies.security.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: destinationrules.networking.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: envoyfilters.networking.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: gateways.networking.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: peerauthentications.security.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: proxyconfigs.networking.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: requestauthentications.security.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: serviceentries.networking.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: sidecars.networking.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: telemetries.telemetry.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: virtualservices.networking.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: wasmplugins.extensions.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: workloadentries.networking.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: workloadgroups.networking.istio.io.istio-system checked successfully
Checked 14 custom resource definitions
Checked 1 Istio Deployments
Checked 2 Istio Daemonsets
✔ Istio is installed and verified successfully

Gateway API CRD安装

istio兼容Gateway API标准,我们后面会通过Gateway API进行服务配置

kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.1.0/standard-install.yaml

测试应用

bookinfo说明(AI生成):
Istio 的 Bookinfo 示例应用是一个用于演示 Istio 多种特性的微服务应用。该应用由四个独立的微服务组成,这些微服务共同模拟了一个在线书店的页面,显示书籍的详细信息和用户评论。Bookinfo 应用的微服务包括:

  • productpage:这个微服务调用 details 和 reviews 微服务来生成页面内容。
  • details:提供书籍的详细信息。
  • reviews:提供书籍相关的评论。这个微服务还有三个不同的版本(v1、v2、v3),用于演示服务的多个版本之间的流量路由。
    • v1:不调用 ratings 服务。
    • v2:调用 ratings 服务,并显示黑色星形评分。
    • v3:调用 ratings 服务,并显示红色星形评分。
  • ratings:提供书籍评分信息。

先标记default命名空间受istio ambient管理

kubectl label namespace default istio.io/dataplane-mode=ambient

安装bookinfo

 cd istio-1.23.2/samples/kubectl apply -f bookinfo/platform/kube/bookinfo.yamlkubectl apply -f bookinfo/platform/kube/bookinfo-versions.yamlkubectl apply -f bookinfo/gateway-api/bookinfo-gateway.yaml

查看book服务

longtds@ubuntu:~$ kubectl get pod
NAME                                      READY   STATUS    RESTARTS   AGE
bookinfo-gateway-istio-799d769db8-txgxn   1/1     Running   0          105m
details-v1-7d775cb4f6-9gsfn               1/1     Running   0          105m
productpage-v1-7c4b6b857-jrflm            1/1     Running   0          105m
ratings-v1-5b896f8544-r2njv               1/1     Running   0          105m
reviews-v1-746f96c9d4-t7746               1/1     Running   0          105m
reviews-v2-97bdf5876-zz5pk                1/1     Running   0          105m
reviews-v3-77d9db6844-zdzvj               1/1     Running   0          105m
longtds@ubuntu:~$ kubectl get svc
NAME                     TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)            AGE
bookinfo-gateway-istio   ClusterIP   10.96.103.133   <none>        15021/TCP,80/TCP   104m
details                  ClusterIP   10.96.253.66    <none>        9080/TCP           104m
details-v1               ClusterIP   10.96.166.107   <none>        9080/TCP           104m
kubernetes               ClusterIP   10.96.0.1       <none>        443/TCP            121m
productpage              ClusterIP   10.96.161.150   <none>        9080/TCP           104m
productpage-v1           ClusterIP   10.96.102.109   <none>        9080/TCP           104m
ratings                  ClusterIP   10.96.237.229   <none>        9080/TCP           104m
ratings-v1               ClusterIP   10.96.110.23    <none>        9080/TCP           104m
reviews                  ClusterIP   10.96.41.171    <none>        9080/TCP           104m
reviews-v1               ClusterIP   10.96.91.54     <none>        9080/TCP           104m
reviews-v2               ClusterIP   10.96.167.90    <none>        9080/TCP           104m
reviews-v3               ClusterIP   10.96.202.181   <none>        9080/TCP           104m

设置bookinfo-gateway服务类型为NodePort

longtds@ubuntu:~$ kubectl annotate gateway bookinfo-gateway networking.istio.io/service-type=NodePort --namespace=default
gateway.gateway.networking.k8s.io/bookinfo-gateway annotated
# 修改nodeport为kind预分配的端口
longtds@ubuntu:~$ kubectl edit svc bookinfo-gateway-istio
service/bookinfo-gateway-istio edited
longtds@ubuntu:~$ kubectl get svc bookinfo-gateway-istio
NAME                     TYPE       CLUSTER-IP     EXTERNAL-IP   PORT(S)                        AGE
bookinfo-gateway-istio   NodePort   10.96.160.96   <none>        15021:30440/TCP,80:30081/TCP   2m49s

访问服务

通过浏览器访问bookinfo,多刷新几次发现可以切换不同的review版本
在这里插入图片描述

查看服务网格

先配置istio-system下kiali服务类型为NodePort,并使用kind预分配端口,然后通过浏览器访问:

longtds@ubuntu:~$ kubectl edit svc -n istio-system kiali
service/kiali edited
longtds@ubuntu:~$ kubectl get svc -n istio-system kiali
NAME    TYPE       CLUSTER-IP      EXTERNAL-IP   PORT(S)                          AGE
kiali   NodePort   10.96.212.195   <none>        20001:30082/TCP,9090:30204/TCP   119m

在这里插入图片描述
通过脚本模拟请求,并观察kiali中的链路传输情况:

for i in $(seq 1 100); do curl -s http://192.168.121.136:30081/productpage;sleep 1; done

在这里插入图片描述
至此完成基本测试,仅仅算是测试环境的初步搭建。对于istio的各种功能将逐步进行测试。

总结

rootless模式下的kind k8s兼容istio ambient模式应用的链路观测。


http://www.ppmy.cn/devtools/128236.html

相关文章

ESP32-S3学习笔记:分区表(Partition Table)的二进制分析

目录 一、参考资料 二、准备工作 三、开始分析 一、参考资料 用于研究的官方示例代码&#xff1a;esp-idf-v5.3\examples\storage\partition_api\partition_find参考的官方文档&#xff1a;ESP-IDF编程指南&#xff1a;分区表 二、准备工作 用VS Code打开示例代码&#xf…

Java最全面试题->Java基础面试题->JavaSE面试题->面向对象面试题

文章目录 面向对象1.面向对象和面向过程的区别2.面向对象有哪些特性3.多态的实现机制4.Java语言有哪些特点5.JDK、JRE、JVM三者的联系和区别 面向对象 下边是我自己整理的面试题&#xff0c;基本已经很全面了&#xff0c;想要的可以私信我&#xff0c;我会不定期去更新思维导图…

C++中的vector使用与实现

一、vector的使用 1.1 vector的定义 是一种类模板 template < class T, class Alloc allocator<T> > class vector; 其中的模板参数Alloc是在使用空间配置器&#xff08;内存池&#xff09;&#xff0c;并给了缺省值&#xff0c;暂时不深究 1.2遍历方式 1.…

12、论文阅读:SpikeYOLO:高性能低能耗目标检测网络

SpikeYOLO:高性能低能耗目标检测网络 前言解释介绍相关工作论文提出的方法网络输入SpikeYOLO架构概述网络输出宏观设计微观设计I-LIF脉冲神经元LIFI-LIF实验代码前言 脉冲神经网络(Spiking Neural Networks, SNNs)具有生物合理性和低功耗的优势,相较于人工神经网络(Artif…

毕设项目分享 深度学习动物识别系统(源码+论文)

文章目录 0 前言1 项目运行效果1 背景2 算法原理2.1 动物识别方法概况2.2 常用的网络模型2.2.1 B-CNN2.2.2 SSD 3 SSD动物目标检测流程4 实现效果5 部分相关代码5.1 数据预处理5.2 构建卷积神经网络5.3 tensorflow计算图可视化5.4 网络模型训练5.5 对猫狗图像进行2分类 6 最后 …

每日一题——第一百一十七题

题目&#xff1a;使用二分查找&#xff0c;查找一个数是否存在于一个升序数组中 #include <stdio.h>int binarySearch(int arr[], int length, int elem);int main() {int arr[] { 2, 3, 4, 5, 6, 7, 8, 9, 10 };int key;int length sizeof(arr) / sizeof(arr[0]);pri…

Vue预渲染:深入探索prerender-spa-plugin与vue-meta-info的联合应用

在前端开发的浪潮中&#xff0c;Vue.js凭借其轻量级、易上手和高效的特点&#xff0c;赢得了广大开发者的青睐。然而&#xff0c;单页面应用&#xff08;SPA&#xff09;在SEO方面的短板一直是开发者们需要面对的挑战。为了优化SEO&#xff0c;预渲染技术应运而生&#xff0c;而…

C盘爆满,Docker ext4.vhdx 迁移

实操记录&#xff1a;AppData\Local\Docker\wsl\data\ext4.vhdx 是 Docker 在 Windows 系统上使用的虚拟磁盘文件。该文件用于存储 Docker 容器和镜像等数据&#xff0c;且通常会占用较大的磁盘空间。考虑到 C 盘空间有限&#xff0c;且随着 Docker 的使用&#xff0c;该文件的…