Exam CKA Topic 3 Question 6 Discussion
Actual exam question for Linux Foundation's CKA exam
Question #: 6
Topic #: 3
Question #: 6
Topic #: 3
You have a Kubernetes cluster with a NodePort service exposing a web application on port 30080. You need to restrict access to this service from specific IP addresses (192.168.1.10 and 10.0.0.1) using NetworkPolicy.
Suggested Answer:
See the solution below with Step by Step Explanation.
Explanation:
Create the necessary NetworkPolicy to enforce this restriction.
Solution (Step by Step) :
Step 1: Create a NetworkPolicy to restrict access to the web application service.

Step 2: Apply the NetworkPolicy to the cluster. kubectl apply -f web-app-access-restriction.yaml This NetworkPolicy will restrict ingress traffic to the web application service to only the specified IP addresses. The 'podSelector: {F ensures that this policy applies to all pods in the 'default' namespace. The 'egress' section allows all outbound traffic from the pods. Now, only the specified IP addresses can access the web application service exposed through NodePort.,
Explanation:
Create the necessary NetworkPolicy to enforce this restriction.
Solution (Step by Step) :
Step 1: Create a NetworkPolicy to restrict access to the web application service.

Step 2: Apply the NetworkPolicy to the cluster. kubectl apply -f web-app-access-restriction.yaml This NetworkPolicy will restrict ingress traffic to the web application service to only the specified IP addresses. The 'podSelector: {F ensures that this policy applies to all pods in the 'default' namespace. The 'egress' section allows all outbound traffic from the pods. Now, only the specified IP addresses can access the web application service exposed through NodePort.,
by Lester at Sep 03, 2026, 11:09 PM
Contact Us
If you have any question please leave me your email address, we will reply and send email to you in 12 hours.
Our Working Time: ( GMT 0:00-15:00 ) From Monday to Saturday
Support: Contact now
Comments
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Report Comment
Commenting
You can sign-up / login (it's free).