apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: math-exercises-netpol spec: podSelector: matchLabels: app: math-exercises policyTypes: - Ingress - Egress ingress: # Allow inbound traffic to container port - from: ports: - protocol: TCP port: 8000 egress: # Allow outbound DNS resolution - to: ports: - protocol: TCP port: 53 - protocol: UDP port: 53 # Allow outbound HTTPS - to: ports: - protocol: TCP port: 443