Exam CKA Topic 3 Question 64 Discussion
Actual exam question for Linux Foundation's CKA exam
Question #: 64
Topic #: 3
Question #: 64
Topic #: 3
You have a deployment named 'web-app' with three replicas, exposing the application using a 'LoadBalancer' service. The application uses an internal database service named 'db-service' that is running as a 'ClusterlP' service. You need to configure the 'web-app' deployment to only allow traffic from the service' to its internal port (e.g., 5432).
Suggested Answer:
See the solution below with Step by Step Explanation.
Explanation:
Solution (Step by Step) :
1. Create a NetworkPolicy:
- Create a NetworkPolicy resource that allows traffic from the 'db-service' to the 'web-app' Deployment.

2. Apply the NetworkPolicy: - Apply the YAML file using 'kubectl apply -f networkpolicy.yaml'. 3. Verify the NetworkPolicy: - Check the status of the NetworkPolicy using 'kubectl get networkpolicies allow-db-to-web-app -n . 4. Test: - Ensure that the 'db-service' can communicate with the 'web-app' deployment on port 5432. - Attempt to connect to port 5432 on 'web-app' pods from outside the cluster or from other services/pods within the cluster that are not the 'db-service'. You should not be able to connect. Note: Replace with the actual namespace where your deployments and services are located.
Explanation:
Solution (Step by Step) :
1. Create a NetworkPolicy:
- Create a NetworkPolicy resource that allows traffic from the 'db-service' to the 'web-app' Deployment.

2. Apply the NetworkPolicy: - Apply the YAML file using 'kubectl apply -f networkpolicy.yaml'. 3. Verify the NetworkPolicy: - Check the status of the NetworkPolicy using 'kubectl get networkpolicies allow-db-to-web-app -n . 4. Test: - Ensure that the 'db-service' can communicate with the 'web-app' deployment on port 5432. - Attempt to connect to port 5432 on 'web-app' pods from outside the cluster or from other services/pods within the cluster that are not the 'db-service'. You should not be able to connect. Note: Replace with the actual namespace where your deployments and services are located.
by Elmer at Sep 05, 2025, 02:04 PM
0
0
0
10
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).