Kubernetes CKA sample exam question 129 with answer

Question
Create a NetworkPolicy called deny-outgoing which does NOT allow any outgoing traffic from secure namespace

Answer
The task is to deny ALL outgoing traffic which means the NetworkPolicy should deny all egress traffic:

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: deny-outgoing
  namespace: secure
spec:
  podSelector: {}
  policyTypes:
  - Egress