Question 31

Create a PSP that will prevent the creation of privileged pods in the namespace.
Create a new PodSecurityPolicy named prevent-privileged-policy which prevents the creation of privileged pods.
Create a new ServiceAccount named psp-sa in the namespace default.
Create a new ClusterRole named prevent-role, which uses the newly created Pod Security Policy prevent-privileged-policy.
Create a new ClusterRoleBinding named prevent-role-binding, which binds the created ClusterRole prevent-role to the created SA psp-sa.
Also, Check the Configuration is working or not by trying to Create a Privileged pod, it should get failed.

Question 32

Context
A default-deny NetworkPolicy avoids to accidentally expose a Pod in a namespace that doesn't have any other NetworkPolicy defined.
Task
Create a new default-deny NetworkPolicy named defaultdeny in the namespace testing for all traffic of type Egress.
The new NetworkPolicy must deny all Egress traffic in the namespace testing.
Apply the newly created default-deny NetworkPolicy to all Pods running in namespace testing.

Question 33

You are managing a Kubernetes cluster with several deployments running different microservices. You need to ensure that all pods are running with appropriate security context constraints (SCCs) to minimize the risk of privilege escalation and other security vulnerabilities. Explain how you would implement and enforce pod security standards using SCCs, providing specific examples ot common security constraints and how you would configure them for various deployment scenarios.

Question 34

You are tasked with securing a Kubemetes cluster that is running on AWS- One of the security best practices you want to implement is to limit tne number of IP addresses that can access the Kubernetes API server. You need to configure the 'kube-apiserver' to only allow access from specific IP addresses, using the '--insecure-bind-address' flag to restrict access.
How would you configure 'kube-apiserver' to achieve this using an '--insecure-bind-address' flag, but allow access from only specific IP addresses?

Question 35

Your organization is running a critical application in a Kubernetes cluster, and you need to implement a system to monitor and detect any malicious activity within the containers. Describe how you can leverage audit logs and container runtime security tools like Sysdig to achieve this goal.