Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Linux Foundation CKS Exam - Topic 6 Question 66 Discussion

Posted by Jesusita on Sep 17, 2024 at 02:06 AM

You can switch the cluster/configuration context using the following command: [desk@cli] $kubectl config use-context dev A default-deny NetworkPolicy avoid to accidentally expose a Pod in a namespace that doesn't have any other NetworkPolicy defined.

Task: Create a new default-deny NetworkPolicy nameddeny-networkin the namespacetestfor all traffic of type Ingress + Egress

The new NetworkPolicy must deny all Ingress + Egress traffic in the namespacetest.

Apply the newly createddefault-denyNetworkPolicy to all Pods running in namespacetest.

You can find a skeleton manifests file at /home/cert_masters/network-policy.yaml

Suggested Answer: A

Get Premium CKS Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
29 comments · newest first
GR
Gregg 11 months ago
I thought you could still allow some traffic with exceptions?
BE
Bernardo 11 months ago
Yup, that's how you keep things secure in Kubernetes!
DA
Darell 12 months ago
Wait, does this really block all traffic? Seems a bit extreme.
GE
Gennie 12 months ago
Totally agree, default-deny is a must for security!
ME
Mel 1 year ago
Just a reminder, the command to switch context is `kubectl config use-context dev`.
KA
Kayleigh 1 year ago
I feel like I’ve seen the command to apply the policy before, but I hope I remember the right file name when I apply it.
AL
Alpha 1 year ago
I’m a bit confused about the difference between Ingress and Egress in the policy. Do I really need to list both types in the spec?
GE
Gerardo 1 year ago
I think we did a similar question where we had to deny traffic in a namespace. I just need to make sure I apply it correctly after editing the YAML file.
CA
Carylon 1 year ago
I remember we practiced creating a default-deny NetworkPolicy, but I’m not sure if I need to specify any pod selectors or just leave it empty.
BR
Brett 1 year ago
I'm feeling confident about this one. I'll create the NetworkPolicy, set the correct namespace, and apply it to the test environment. Should be a straightforward task.
LO
Lorita 1 year ago
This seems like a pretty standard NetworkPolicy task. I'll follow the steps outlined in the question and use the provided skeleton file to get it done.
LE
Leonida 1 year ago
Okay, I think I've got a good understanding of what I need to do. I'll create the NetworkPolicy, making sure to deny both Ingress and Egress traffic, and apply it to the test namespace.
RE
Rebeca 1 year ago
Hmm, I'm a bit unsure about the exact syntax for the NetworkPolicy. Let me double-check the documentation to make sure I get the details right.
KA
Kayleigh 1 year ago
This looks straightforward. I'll create the NetworkPolicy manifest file based on the provided skeleton and apply it to the test namespace.
SV
Svetlana 1 year ago
I think the concept we need here is related to access control, but did we ever cover "Deny URL"? That sounds familiar too.
AL
Albert 2 years ago
Hold on, let me double-check the NetworkPolicy syntax. Ah, got it! This is a classic Kubernetes networking question. Time to put my skills to the test.
LA
Lajuana 2 years ago
↳ replying to Albert
User2
BR
Brandee 2 years ago
↳ replying to Albert
User1
MA
Matthew 2 years ago
Yes, following the steps in the reference link can guide us through the process.
KE
Kenneth 2 years ago
I agree, but the explanation provided with the manifest file is helpful.
GE
German 2 years ago
Haha, this is like a walk in the park. The trick is to remember that a default-deny NetworkPolicy is the way to go when there's no other policy defined. Just follow the steps and you're golden.
JE
Jeannetta 2 years ago
↳ replying to German
Following the steps makes it easy.
HU
Hui 2 years ago
↳ replying to German
Remember to deny all Ingress + Egress traffic in the namespace test.
VA
Valentin 2 years ago
↳ replying to German
Just create the new NetworkPolicy and apply it to the Pods.
OR
Oretha 2 years ago
↳ replying to German
I agree, default-deny NetworkPolicy is the key.
MA
Matthew 2 years ago
I think the question about creating a default-deny NetworkPolicy is tricky.
CA
Carlota 2 years ago
Easy peasy! Just run the `k get pods -n test --show-labels` command to see the pods, then create the NetworkPolicy YAML and apply it. Boom, job done!
AN
Annmarie 2 years ago
↳ replying to Carlota
No problem, happy to help!
TH
Theodora 2 years ago
↳ replying to Carlota
Thanks for the tip! I'll give that a try.
0/2000 characters

Save Cancel