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 67 Discussion

Posted by Marvel on Sep 15, 2024 at 04:08 PM

You can switch the cluster/configuration context using the following command: [desk@cli] $kubectl config use-context stage Context: A PodSecurityPolicy shall prevent the creation of privileged Pods in a specific namespace. Task: 1. Create a new PodSecurityPolcy named deny-policy, which prevents the creation of privileged Pods. 2. Create a new ClusterRole name deny-access-role, which uses the newly created PodSecurityPolicy deny-policy. 3. Create a new ServiceAccount named psd-denial-sa in the existing namespace development. Finally, create a new ClusterRoleBindind named restrict-access-bind, which binds the newly created ClusterRole deny-access-role to the newly created ServiceAccount psp-denial-sa

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
30 comments · newest first
JI
Jillian 11 months ago
I think the YAML has a typo in "restrict-access-bing" - should be "binding".
MA
Maryann 11 months ago
Nice, this is a solid way to restrict access!
RO
Rosita 12 months ago
Wait, are we really still using PSPs? I thought they were phased out!
AL
Alona 12 months ago
Totally agree, we should be using OPA/Gatekeeper instead.
JE
Jesusa 1 year ago
Just a reminder, PodSecurityPolicies are deprecated in newer Kubernetes versions!
RO
Ronald 1 year ago
I feel like I’ve seen a question like this before, but I’m a bit confused about how to reference the PodSecurityPolicy in the ClusterRole. Is it `resourceNames` or something else?
KR
Kris 1 year ago
I believe the command to create the ServiceAccount is `kubectl create sa`, but I might have to double-check the namespace part.
EM
Emilio 1 year ago
I practiced a similar question where we had to create a ClusterRoleBinding, but I keep mixing up the names for the role and the service account.
BR
Britt 1 year ago
I think I remember that the PodSecurityPolicy should have `privileged: false` to prevent privileged Pods, but I'm not sure about the exact syntax for the YAML file.
HU
Huey 1 year ago
This seems like a good opportunity to practice my YAML skills. I'll make sure to double-check my syntax and resource definitions before applying them.
LO
Lonny 1 year ago
Okay, I've got a plan. First, I'll create the PodSecurityPolicy to prevent privileged Pods. Then I'll create the ClusterRole to use that policy, and finally the ClusterRoleBinding to link the ServiceAccount to the ClusterRole.
AN
Andree 1 year ago
Hmm, I'm a bit confused about the ClusterRole and ClusterRoleBinding. Do I need to create them in a specific namespace or can I do it at the cluster level?
LE
Leah 1 year ago
This question looks straightforward, I think I can handle it. I'll need to create the PodSecurityPolicy, ClusterRole, and ClusterRoleBinding as specified.
SH
Shanice 1 year ago
The search peer handles indexing and search requests, right? That sounds like the component this question is asking about.
DE
Derick 2 years ago
This is a solid solution, but I'm wondering if there are any potential pitfalls or edge cases we should consider. It's always good to think about the what-ifs.
MA
Margart 2 years ago
↳ replying to Derick
User3: Agreed, we should think about any possible issues that may arise.
MA
Marica 2 years ago
↳ replying to Derick
User2: It's always good to consider the what-ifs.
VI
Vincenza 2 years ago
↳ replying to Derick
Have you thought about any potential pitfalls or edge cases with this solution?
LA
Lashawn 2 years ago
The example looks great, but I'm curious if there's a way to make the `PodSecurityPolicy` more flexible. Perhaps we could add some additional rules or constraints to handle different use cases.
VI
Vinnie 2 years ago
↳ replying to Lashawn
User3
CA
Camellia 2 years ago
↳ replying to Lashawn
User2
AL
Alpha 2 years ago
↳ replying to Lashawn
User1
JE
Jeannetta 2 years ago
Exactly, then we create a ServiceAccount and bind it to the ClusterRole.
VE
Verona 2 years ago
Yes, we need to create deny-policy and bind it to deny-access-role.
JE
Jeannetta 2 years ago
I think the question is about creating a PodSecurityPolicy to prevent privileged Pods.
LI
Lili 2 years ago
The solution seems comprehensive, but I'm wondering if there's a more concise way to achieve the same result. Maybe we can combine some of the YAML manifests into a single file.
FR
Francoise 2 years ago
Haha, I like how they're using `psp-denial-sa` as the service account name. It's like they're telling the Pods, 'No privileged access for you!'
DE
Dewitt 2 years ago
Looks good, but I'm not sure if the `resourceNames` field in the `ClusterRole` is necessary. I thought the `use` verb alone would be enough to bind the `PodSecurityPolicy` to the `ClusterRole`.
ER
Erinn 2 years ago
↳ replying to Dewitt
I see, thanks for clarifying that. It's always good to double-check the documentation to be sure.
ET
Ettie 2 years ago
↳ replying to Dewitt
The `resourceNames` field is used to specify which `PodSecurityPolicy` the `ClusterRole` should use.
0/2000 characters

Save Cancel