Exam CKS Topic 2 Question 63 Discussion
Actual exam question for Linux Foundation's CKS exam
Question #: 63
Topic #: 2
Question #: 63
Topic #: 2
You need to implement a secure network policy that allows communication only between specific pods within a namespace. For example, you want to allow communication between pods that have the label 'app=frontend' and pods that have the label 'app=backend', but block all other communication within the namespace.
Suggested Answer:
Solution (Step by Step) :
1. Create a NetworkPolicy:
- Define a NetworkP01icy that allows communication between 'frontend' and 'backend' pods, but blocks other communication within the namespace.

2. Create a Frontend Pod: - Create a Pod with the label 'app=frontend'.

3. Create a Backend Pod: - Create a Pod With the label 'app=backend'.

4. Apply the YAML files: - Apply the created YAML files using ' kubectl apply -f 5. Verify the Network Policy: - Try to connect from the 'frontend-pod' to the 'backend-pod' (e.g., using ' kubectl exec -it frontend-pod bash' and 'curl backend-pod:80')- It should succeed. - Try to connect from the 'frontend-pod' to another pod in the namespace that doesn't have the Sapp-backend' label. This connection should be blocked.
1. Create a NetworkPolicy:
- Define a NetworkP01icy that allows communication between 'frontend' and 'backend' pods, but blocks other communication within the namespace.

2. Create a Frontend Pod: - Create a Pod with the label 'app=frontend'.

3. Create a Backend Pod: - Create a Pod With the label 'app=backend'.

4. Apply the YAML files: - Apply the created YAML files using ' kubectl apply -f 5. Verify the Network Policy: - Try to connect from the 'frontend-pod' to the 'backend-pod' (e.g., using ' kubectl exec -it frontend-pod bash' and 'curl backend-pod:80')- It should succeed. - Try to connect from the 'frontend-pod' to another pod in the namespace that doesn't have the Sapp-backend' label. This connection should be blocked.
by Elma at Jun 04, 2026, 11:11 AM
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).