其他分享
首页 > 其他分享> > Kubernetes学习笔记(二十九):Network Policy

Kubernetes学习笔记(二十九):Network Policy

作者:互联网

Network Policy

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: db-policy
spec:
  podSelector:
    matchLabels:
      role: db
  policyTypes:
  - Ingress ## 设置入口规则,不会影响出口
  ingress:
  - from:
    - podSelector:
        matchLabels:
          name: api-pod
    ports:
    - protocol: TCP
      port: 3306

标签:name,Kubernetes,db,matchLabels,podSelector,Policy,Network
来源: https://www.cnblogs.com/Bota5ky/p/16678398.html