apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: test-network-policy
  namespace: default
spec:
  podSelector:
    matchLabels:
      role: db
  policyTypes:
  - Ingress
  - Egress

参考文档:https://kubernetes.io/zh/docs/concepts/services-networking/network-policies/

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐