Certified Kubernetes Administrator (CKA) · Free practice question 11 of 12
NetworkPolicy ipBlock with except
Pods in namespace export at Aysgarth Media may send traffic to the partner range 203.0.113.0/24 except the host 203.0.113.9. How is this written in an egress rule?
- A.ipBlock: {cidr: 203.0.113.0/24, deny: [203.0.113.9]}
- B.ipBlock: {cidr: 203.0.113.0/24, except: [203.0.113.9/32]}
- C.namespaceSelector: {cidr: 203.0.113.0/24, except: [203.0.113.9]}
- D.ipBlock: {cidr: 203.0.113.9/32, invert: true}
Show answer and explanation
Correct answer: B. ipBlock: {cidr: 203.0.113.0/24, except: [203.0.113.9/32]}
Why: ipBlock selects IP ranges outside the pod network, and except lists CIDRs inside that range to leave out, so a /32 removes a single host. There is no deny or invert field, and namespaceSelector selects namespaces by label rather than by IP.
More free Certified Kubernetes Administrator (CKA) questions
- Drain flags for DaemonSets and emptyDir
- CronJob concurrencyPolicy Forbid
- Listing cluster-scoped API resources
- Setting the default namespace in a context
- Session affinity by client IP
- Pod dnsPolicy Default versus ClusterFirst
- Raw block volumes with volumeMode
- Debugging a node with kubectl debug
- CreateContainerConfigError from missing ConfigMap
- Approving a client CertificateSigningRequest
- Restoring a PVC from a VolumeSnapshot