apiVersion: security.istio.io/v1beta1 kind: AuthorizationPolicy metadata:name: allow-web-frontend-customersnamespace: default spec:selector:matchLabels:app: customersversion: v1action: ALLOWrules:- from:- source:namespaces: ["default"]source:principals: ["cluster.local/ns/default/sa/web-frontend"]
将上述 YAML 保存为 allow-web-frontend-customers.yaml
,并使用 kubectl apply -f allow-web-frontend-customers.yaml
创建策略 。
一旦策略被创建 , 我们将看到 Web 前端再次工作——它将获得 customers 服务的回应 。
我们使用了多个授权策略 , 明确地允许从入口到前端以及从前端到 customers 服务的调用 。使用 deny-all
策略是一个很好的开始,因为我们可以控制、管理,然后明确地允许我们希望在服务之间发生的通信 。
4.2 清理删除 Deployment、Service、VirtualService 和 Gateway:
kubectl delete sa customers-v1 web-frontend kubectl delete deploy web-frontend customers-v1 kubectl delete svc customers web-frontend kubectl delete vs customers web-frontend kubectl delete gateway gateway kubectl delete authorizationpolicy allow-ingress-frontend allow-web-frontend-customers deny-all kubectl delete pod curl
推荐阅读
- 五 Istio:使用服务网格Istio进行流量路由
- 二 Istio:在Kubernetes(k8s)集群上安装部署istio1.14
- 魅族18和一加9对比_魅族18和一加9参数对比
- ipad分屏怎么打开(ipad第九代可以分屏吗)
- 九都金柜保险柜怎么开(全能保险柜怎么开)
- 少女前线纵向应变第九交响曲怎么通关
- 九重试炼免广告卷怎么获取
- 九重试炼免广告卷获取方式是什么
- 九宫格数独怎么玩(9宫格万能口诀)
- 中国钱币网|中国钱币收藏网