备考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

相关文章

浅谈配置MMCV环境,解决报错,版本不匹配问题

《浅谈配置MMCV环境,解决报错,版本不匹配问题》:本文主要介绍浅谈配置MMCV环境,解决报错,版本不匹配问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录配置MMCV环境,解决报错,版本不匹配错误示例正确示例总结配置MMCV环境,解决报错,版本不匹配在col

Nginx中配置HTTP/2协议的详细指南

《Nginx中配置HTTP/2协议的详细指南》HTTP/2是HTTP协议的下一代版本,旨在提高性能、减少延迟并优化现代网络环境中的通信效率,本文将为大家介绍Nginx配置HTTP/2协议想详细步骤,需... 目录一、HTTP/2 协议概述1.HTTP/22. HTTP/2 的核心特性3. HTTP/2 的优

Python 安装和配置flask, flask_cors的图文教程

《Python安装和配置flask,flask_cors的图文教程》:本文主要介绍Python安装和配置flask,flask_cors的图文教程,本文通过图文并茂的形式给大家介绍的非常详细,... 目录一.python安装:二,配置环境变量,三:检查Python安装和环境变量,四:安装flask和flas

Java编译生成多个.class文件的原理和作用

《Java编译生成多个.class文件的原理和作用》作为一名经验丰富的开发者,在Java项目中执行编译后,可能会发现一个.java源文件有时会产生多个.class文件,从技术实现层面详细剖析这一现象... 目录一、内部类机制与.class文件生成成员内部类(常规内部类)局部内部类(方法内部类)匿名内部类二、

SpringCloud动态配置注解@RefreshScope与@Component的深度解析

《SpringCloud动态配置注解@RefreshScope与@Component的深度解析》在现代微服务架构中,动态配置管理是一个关键需求,本文将为大家介绍SpringCloud中相关的注解@Re... 目录引言1. @RefreshScope 的作用与原理1.1 什么是 @RefreshScope1.

SpringBoot日志配置SLF4J和Logback的方法实现

《SpringBoot日志配置SLF4J和Logback的方法实现》日志记录是不可或缺的一部分,本文主要介绍了SpringBoot日志配置SLF4J和Logback的方法实现,文中通过示例代码介绍的非... 目录一、前言二、案例一:初识日志三、案例二:使用Lombok输出日志四、案例三:配置Logback一

springboot security之前后端分离配置方式

《springbootsecurity之前后端分离配置方式》:本文主要介绍springbootsecurity之前后端分离配置方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的... 目录前言自定义配置认证失败自定义处理登录相关接口匿名访问前置文章总结前言spring boot secu

一文详解SpringBoot响应压缩功能的配置与优化

《一文详解SpringBoot响应压缩功能的配置与优化》SpringBoot的响应压缩功能基于智能协商机制,需同时满足很多条件,本文主要为大家详细介绍了SpringBoot响应压缩功能的配置与优化,需... 目录一、核心工作机制1.1 自动协商触发条件1.2 压缩处理流程二、配置方案详解2.1 基础YAML

springboot简单集成Security配置的教程

《springboot简单集成Security配置的教程》:本文主要介绍springboot简单集成Security配置的教程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,... 目录集成Security安全框架引入依赖编写配置类WebSecurityConfig(自定义资源权限规则

SpringBoot中封装Cors自动配置方式

《SpringBoot中封装Cors自动配置方式》:本文主要介绍SpringBoot中封装Cors自动配置方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录SpringBoot封装Cors自动配置背景实现步骤1. 创建 GlobalCorsProperties