Skip to content

Latest commit

 

History

History
32 lines (30 loc) · 544 Bytes

33.NetworkPolicies.md

File metadata and controls

32 lines (30 loc) · 544 Bytes
https://kubernetes.io/docs/concepts/services-networking/network-policies/
networkpolicy

kubectl get networkpolicy

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: internal-policy
spec:
  podSelector:
    matchLabels:
      name: internal
  policyTypes:
  - Egress
  egress:
  - to:
    - podSelector:
        matchLabels:
          name: mysql
    ports:
    - protocol: TCP
      port: 3306
  - to:
    - podSelector:
        matchLabels:
          name: payroll
    ports:
    - protocol: TCP
      port: 8080