k8s-samples/CKA_Course/networkpolicy.yaml

22 lines
368 B
YAML
Raw Normal View History

2022-08-17 02:59:58 +00:00
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: my-network-policy
spec:
podSelector:
matchLabels:
role: db
ingress:
- from:
- podSelector:
matchLabels:
app: db
egress:
- to:
- namespaceSelector:
matchLabels:
app: web
ports:
- protocol: TCP
port: 80