PeerAuthentication详解

Istio深度解析:多集群、链路追踪与安全配置实战
该公众号分享了一系列关于Istio的文章,涵盖多集群部署、链路追踪、故障注入、业务权限控制、 EnvoyFilter 使用等多个方面,深入探讨Istio的安全配置,包括PeerAuthentication的模式设置及其对工作负载的影响,帮助读者理解并掌握Istio的高级用法。

 欢迎关注我的公众号:

 目前刚开始写一个月,一共写了18篇原创文章,文章目录如下:

istio多集群探秘,部署了50次多集群后我得出的结论

istio多集群链路追踪,附实操视频

istio防故障利器,你知道几个,istio新手不要读,太难!

istio业务权限控制,原来可以这么玩

istio实现非侵入压缩,微服务之间如何实现压缩

不懂envoyfilter也敢说精通istio系列-http-rbac-不要只会用AuthorizationPolicy配置权限

不懂envoyfilter也敢说精通istio系列-02-http-corsFilter-不要只会vs

不懂envoyfilter也敢说精通istio系列-03-http-csrf filter-再也不用再代码里写csrf逻辑了

不懂envoyfilter也敢说精通istio系列http-jwt_authn-不要只会RequestAuthorization

不懂envoyfilter也敢说精通istio系列-05-fault-filter-故障注入不止是vs

不懂envoyfilter也敢说精通istio系列-06-http-match-配置路由不只是vs

不懂envoyfilter也敢说精通istio系列-07-负载均衡配置不止是dr

不懂envoyfilter也敢说精通istio系列-08-连接池和断路器

不懂envoyfilter也敢说精通istio系列-09-http-route filter

不懂envoyfilter也敢说精通istio系列-network filter-redis proxy

不懂envoyfilter也敢说精通istio系列-network filter-HttpConnectionManager

不懂envoyfilter也敢说精通istio系列-ratelimit-istio ratelimit完全手册

学习目标

什么是PeerAuthentication

PeerAuthentication defines how traffic will be(mtls) tunneled (or not) to the sidecar.

资源详解

FieldTypeDescriptionRequired
selectorWorkloadSelectorThe selector determines the workloads to apply the ChannelAuthentication on. If not set, the policy will be applied to all workloads in the same namespace as the policy.No
mtlsMutualTLSMutual TLS settings for workload. If not defined, inherit from parent.No
portLevelMtlsmapPort specific mutual TLS settings.No

没有selector

全局有效

pa-default-global.yaml

apiVersion: security.istio.io/v1beta1
kind: PeerAuthentication
metadata:
  name: default
  namespace: istio-system
spec:
  mtls:
    mode: STRICT

For mesh level, put the policy in root-namespace according to your Istio installation.

默认工作负载都启用mtls

关闭productpage mtls

dr-productpage-mtls-disable.yaml

apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
  name: productpage
spec:
  host: productpage
  subsets:
  - labels:
      version: v1
    name: v1
  trafficPolicy:
    tls:
      mode: DISABLE

访问失败

名称空间有效

pa-default.yaml

apiVersion: security.istio.io/v1beta1
kind: PeerAuthentication
metadata:
  name: default
spec:
  mtls:
    mode: STRICT

selector

pa-productpage-selector.yaml

apiVersion: security.istio.io/v1beta1
kind: PeerAuthentication
metadata:
  name: productpage
spec:
  selector:
    matchLabels:
      app: productpage
  mtls:
    mode: STRICT

mtls

PeerAuthentication.MutualTLS.Mode

NameDescription
UNSETInherit from parent, if has one. Otherwise treated as PERMISSIVE.
DISABLEConnection is not tunneled.
PERMISSIVEConnection can be either plaintext or mTLS tunnel.
STRICTConnection is an mTLS tunnel (TLS with client cert must be presented).

mode

UNSET

pa-productpage-mode-UNSET.yaml

apiVersion: security.istio.io/v1beta1
kind: PeerAuthentication
metadata:
  name: productpage
spec:
  selector:
    matchLabels:
      app: productpage
  mtls:
    mode: UNSET

DISABLE

pa-productpage-mode-DISABLE.yaml

apiVersion: security.istio.io/v1beta1
kind: PeerAuthentication
metadata:
  name: productpage
spec:
  selector:
    matchLabels:
      app: productpage
  mtls:
    mode: DISABLE

PERMISSIVE

pa-productpage-mode-PERMISSIVE.yaml

apiVersion: security.istio.io/v1beta1
kind: PeerAuthentication
metadata:
  name: productpage
spec:
  selector:
    matchLabels:
      app: productpage
  mtls:
    mode: PERMISSIVE

STRICT

pa-productpage-mode-STRICT.yaml

apiVersion: security.istio.io/v1beta1
kind: PeerAuthentication
metadata:
  name: productpage
spec:
  selector:
    matchLabels:
      app: productpage
  mtls:
    mode: STRICT

portLevelMtls

pa-productpage-portLevelMtls.yaml

apiVersion: security.istio.io/v1beta1
kind: PeerAuthentication
metadata:
  name: productpage
spec:
  selector:
    matchLabels:
      app: productpage
  mtls:
    mode: STRICT
  portLevelMtls:
    9080:
      mode: DISABLE
为什么使用istio:云平台令使用它们的公司受益匪浅。但不可否认的是,上云会给 DevOps 团队带来压力。为了可移植性,开发人员必须使用微服务来构建应用,同时运维人员也正在管理着极端庞大的混合云和多云的部署环境。 Istio 允许您连接、保护、控制和观察服务。从较高的层面来说,Istio 有助于降低这些部署的复杂性,并减轻开发团队的压力。它是一个完全开源的服务网格,作为透明的一层接入到现有的分布式应用程序里。它也是一个平台,拥有可以集成任何日志、遥测和策略系统的 API 接口。Istio 多样化的特性使您能够成功且高效地运行分布式微服务架构,并提供保护、连接和监控微服务的统一方法。教学内容:istio原理,envoy原理,envoy案例,envoy配置,istio crd配置,istio流量管理,istio安全配置,istio可观察性,istio策略控制,istio升级,istio常见问题,istio wasm,istio多控制面板,gateway-api,slime教学特色:a.1000多个istio实战案例,20多个envoy案例。800多个envoyfilter案例,全程已实战为主,理论相对较少,案例90%可试验b.涵盖98%以上crd字段配置c.不仅讲解yaml配置,同时结合envoy配置讲解d.不回避难点内容,深入讲解envoyfilter配置e深入讲解envoyf详细讲解额外内容,比如gateway-api,wasm,升降级,发布,灰度发布,蓝绿发布,istioctl命令,slime,多控制面板,多集群,常见问题g以一个完整案例串联所有内容h以markdown文件提供课件,内容详细,方便大家练习I有学员指出我的istio课程不够突出重点,安装80/20原则,20%内容是常用的,那我是否就讲这20%就可以了呢,其他课程确实是这么干的,他们只讲擅长的20%,我的目的不是这样的,我希望istio课程买我的一个就够了,让你全面学习istio,甚至遇到偏的问题不需要百度,课程里就有讲过,但是难免会出现一个问题,就是不够突出重点,我尽量兼顾全面的时候突出重点,讲到重点,核心功能时我会提示下。 
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

hxpjava1

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值