# 第十五题 Network Policy 2 Deny-All ###### tags: `真题讲解` 切换集群kubectl config use-context k8s **Context** A default-deny NetworkPolicy avoids to accidentally expose a Pod in a namespace that doesn't have any other NetworkPolicy defined. **Task** Create a new default-deny NetworkPolicy named **denynetwork** in the namespace **development** for all traffic of type Ingress. The new NetworkPolicy must deny all ingress traffic in the namespace development. Apply the newly created default-deny NetworkPolicy to all Pods running in namespace development. ## 解法 送分题, 直接粘贴修改官网范例: [k8s.io/np/deny-all](https://kubernetes.io/docs/concepts/services-networking/network-policies/#default-deny-all-ingress-traffic) ``` apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: denynetwork namesapce: development spec: podSelector: {} policyTypes: - Ingress ```