备考ICA----Istio实验11---为多个主机配置TLS Istio Ingress Gateway实验

2024-03-28 05:44

本文主要是介绍备考ICA----Istio实验11---为多个主机配置TLS Istio Ingress Gateway实验,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

备考ICA----Istio实验11—为多个主机配置TLS Istio Ingress Gateway实验

1. 部署应用

kubectl apply -f istio/samples/helloworld/helloworld.yaml -l service=helloworld
kubectl apply -f istio/samples/helloworld/helloworld.yaml -l version=v1

2. 证书准备

接上一个实验,准备第二个证书

openssl req -out example_certs_pana/pana.example.com.csr  -newkey rsa:2048 \
-nodes -keyout example_certs_pana/pana.example.com.key \
-subj "/CN=pana.example.com/O=httpbin organization"

签发证书

openssl x509 -req -sha256 -days 365 -CA example_certs_root/example.com.crt \
-CAkey example_certs_root/example.com.key \
-set_serial 0 -in example_certs_pana/pana.example.com.csr \
-out example_certs_pana/pana.example.com.crt

将证书生成secret
因为后续也是使用istio/ingressgateway所以必须放着istio-system命名空间下

kubectl create secret -n istio-system tls  pana-credential \
--key=example_certs_pana/pana.example.com.key \
--cert=example_certs_pana/pana.example.com.crt

确认secret被正确创建

kubectl get secrets -n istio-system 

在这里插入图片描述

3. Istio配置

3.1 Gateway配置

这里新的hello服务和上个实验合用mygateway这个gateway对外提供访问,但各自使用各自的TLS证书.
tls-ingress/2-TLS-gateway.yaml

apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:name: mygateway
spec:selector:istio: ingressgateway                       # use istio default ingress gatewayservers:- port:number: 443name: httpbinprotocol: HTTPStls:mode: SIMPLEcredentialName: httpbin-credential        # must be the same as secrethosts:- httpbin.example.com- port:number: 443name: panaprotocol: HTTPStls:mode: SIMPLEcredentialName: pana-credential   # must be the same as secrethosts:- pana.example.com

3.2 VirtualService配置

在vs中定义了监听mygateway的hosts是pana.example.com,匹配上uri:/hello后转发给svc helloworld的后端进行响应.
tls-ingress/2-TLS-VirtualService.yaml

apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:name: pana
spec:hosts:- "pana.example.com"gateways:- mygatewayhttp:- match:- uri:prefix: /helloroute:- destination:port:number: 5000host: helloworld

在这里插入图片描述
可以看到2个服务使用了同一个gw,但各自又有自己的Vs
在这里插入图片描述

4. 访问测试

4.1 pana.example.com

在这里插入图片描述
linux下

curl -v -HHost:pana.example.com --resolve "pana.example.com:443:192.168.126.220" \--cacert example_certs_root/example.com.crt "https://pana.example.com:443/hello"

在这里插入图片描述

4.2 httpbin.example.com

上一个实验部署的httpbin.example.com

在这里插入图片描述
linux下

curl -v -HHost:httpbin.example.com --resolve \
"httpbin.example.com:443:192.168.126.220" \
--cacert example_certs_root/example.com.crt \
"https://httpbin.example.com:443/status/418"

在这里插入图片描述
至此为多个主机配置TLS Istio Ingress Gateway实验完成

这篇关于备考ICA----Istio实验11---为多个主机配置TLS Istio Ingress Gateway实验的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/854626

相关文章

Spring Boot 3 整合 Spring Cloud Gateway实践过程

《SpringBoot3整合SpringCloudGateway实践过程》本文介绍了如何使用SpringCloudAlibaba2023.0.0.0版本构建一个微服务网关,包括统一路由、限... 目录引子为什么需要微服务网关实践1.统一路由2.限流防刷3.登录鉴权小结引子当前微服务架构已成为中大型系统的标

MySQL zip安装包配置教程

《MySQLzip安装包配置教程》这篇文章详细介绍了如何使用zip安装包在Windows11上安装MySQL8.0,包括下载、解压、配置环境变量、初始化数据库、安装服务以及更改密码等步骤,感兴趣的朋... 目录mysql zip安装包配置教程1、下载zip安装包:2、安装2.1 解压zip包到安装目录2.2

MySQL 中的服务器配置和状态详解(MySQL Server Configuration and Status)

《MySQL中的服务器配置和状态详解(MySQLServerConfigurationandStatus)》MySQL服务器配置和状态设置包括服务器选项、系统变量和状态变量三个方面,可以通过... 目录mysql 之服务器配置和状态1 MySQL 架构和性能优化1.1 服务器配置和状态1.1.1 服务器选项

Python自动化办公之合并多个Excel

《Python自动化办公之合并多个Excel》在日常的办公自动化工作中,尤其是处理大量数据时,合并多个Excel表格是一个常见且繁琐的任务,下面小编就来为大家介绍一下如何使用Python轻松实现合... 目录为什么选择 python 自动化目标使用 Python 合并多个 Excel 文件安装所需库示例代码

Java实现检查多个时间段是否有重合

《Java实现检查多个时间段是否有重合》这篇文章主要为大家详细介绍了如何使用Java实现检查多个时间段是否有重合,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 目录流程概述步骤详解China编程步骤1:定义时间段类步骤2:添加时间段步骤3:检查时间段是否有重合步骤4:输出结果示例代码结语作

Java判断多个时间段是否重合的方法小结

《Java判断多个时间段是否重合的方法小结》这篇文章主要为大家详细介绍了Java中判断多个时间段是否重合的方法,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 目录判断多个时间段是否有间隔判断时间段集合是否与某时间段重合判断多个时间段是否有间隔实体类内容public class D

linux下多个硬盘划分到同一挂载点问题

《linux下多个硬盘划分到同一挂载点问题》在Linux系统中,将多个硬盘划分到同一挂载点需要通过逻辑卷管理(LVM)来实现,首先,需要将物理存储设备(如硬盘分区)创建为物理卷,然后,将这些物理卷组成... 目录linux下多个硬盘划分到同一挂载点需要明确的几个概念硬盘插上默认的是非lvm总结Linux下多

SpringBoot+MyBatis-Flex配置ProxySQL的实现步骤

《SpringBoot+MyBatis-Flex配置ProxySQL的实现步骤》本文主要介绍了SpringBoot+MyBatis-Flex配置ProxySQL的实现步骤,文中通过示例代码介绍的非常详... 目录 目标 步骤 1:确保 ProxySQL 和 mysql 主从同步已正确配置ProxySQL 的

Spring Boot整合log4j2日志配置的详细教程

《SpringBoot整合log4j2日志配置的详细教程》:本文主要介绍SpringBoot项目中整合Log4j2日志框架的步骤和配置,包括常用日志框架的比较、配置参数介绍、Log4j2配置详解... 目录前言一、常用日志框架二、配置参数介绍1. 日志级别2. 输出形式3. 日志格式3.1 PatternL

配置springboot项目动静分离打包分离lib方式

《配置springboot项目动静分离打包分离lib方式》本文介绍了如何将SpringBoot工程中的静态资源和配置文件分离出来,以减少jar包大小,方便修改配置文件,通过在jar包同级目录创建co... 目录前言1、分离配置文件原理2、pom文件配置3、使用package命令打包4、总结前言默认情况下,