Skip to content

Free certification exam prep

  • HOME
  • ALL EXAMS
  • SAP
  • Amazon
  • Cisco
  • CompTIA
  • Google
  • HP
  • Huawei
  • Microsoft
  • Oracle
  • Salesforce
  • Contact
  • Home
  • 2023
  • April
  • 30
  • [2023] CKS Answers CKS Free Demo Are Based On The Real Exam [Q22-Q45]

[2023] CKS Answers CKS Free Demo Are Based On The Real Exam [Q22-Q45]

Posted on April 30, 2023 By freedumps No Comments on [2023] CKS Answers CKS Free Demo Are Based On The Real Exam [Q22-Q45]
CKS, Linux Foundation
5/5 - (1 vote)

[2023] CKS Answers CKS Free Demo Are Based On The Real Exam

CKS [Apr-2023 Newly Released] Exam Questions For You To Pass

The CKS exam is an important certification for anyone who works with Kubernetes and wants to demonstrate their expertise in securing these environments. By passing the exam, individuals can prove to potential employers that they have the skills and knowledge needed to secure Kubernetes clusters and protect the applications that run on them, making them a valuable asset to any organization that uses Kubernetes for their container orchestration and deployment needs.

The Linux Foundation CKS (Certified Kubernetes Security Specialist) Exam is a certification program that is designed to test and validate the skills of IT professionals in securing Kubernetes clusters. Kubernetes has become the most popular container orchestration system, and with its increased adoption, the need for Kubernetes security experts has also grown. The CKS certification program is aimed at IT professionals who already have a good understanding of Kubernetes and want to demonstrate their expertise in securing Kubernetes clusters.

 

NO.22 Context
The kubeadm-created cluster’s Kubernetes API server was, for testing purposes, temporarily configured to allow unauthenticated and unauthorized access granting the anonymous user duster-admin access.
Task
Reconfigure the cluster’s Kubernetes API server to ensure that only authenticated and authorized REST requests are allowed.
Use authorization mode Node,RBAC and admission controller NodeRestriction.
Cleaning up, remove the ClusterRoleBinding for user system:anonymous.





NO.23 Cluster: scanner Master node: controlplane Worker node: worker1
You can switch the cluster/configuration context using the following command:
[desk@cli] $ kubectl config use-context scanner
Given: You may use Trivy’s documentation.
Task: Use the Trivy open-source container scanner to detect images with severe vulnerabilities used by Pods in the namespace nato.
Look for images with High or Critical severity vulnerabilities and delete the Pods that use those images. Trivy is pre-installed on the cluster’s master node. Use cluster’s master node to use Trivy.




NO.24 Fix all issues via configuration and restart the affected components to ensure the new setting takes effect.
Fix all of the following violations that were found against the API server:- a. Ensure that the RotateKubeletServerCertificate argument is set to true.
b. Ensure that the admission control plugin PodSecurityPolicy is set.
c. Ensure that the –kubelet-certificate-authority argument is set as appropriate.
Fix all of the following violations that were found against the Kubelet:- a. Ensure the –anonymous-auth argument is set to false.
b. Ensure that the –authorization-mode argument is set to Webhook.
Fix all of the following violations that were found against the ETCD:-
a. Ensure that the –auto-tls argument is not set to true
b. Ensure that the –peer-auto-tls argument is not set to true
Hint: Take the use of Tool Kube-Bench

Fix all of the following violations that were found against the API server:- a. Ensure that the RotateKubeletServerCertificate argument is set to true.
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
component: kubelet
tier: control-plane
name: kubelet
namespace: kube-system
spec:
containers:
– command:
– kube-controller-manager
+ – –feature-gates=RotateKubeletServerCertificate=true
image: gcr.io/google_containers/kubelet-amd64:v1.6.0
livenessProbe:
failureThreshold: 8
httpGet:
host: 127.0.0.1
path: /healthz
port: 6443
scheme: HTTPS
initialDelaySeconds: 15
timeoutSeconds: 15
name: kubelet
resources:
requests:
cpu: 250m
volumeMounts:
– mountPath: /etc/kubernetes/
name: k8s
readOnly: true
– mountPath: /etc/ssl/certs
name: certs
– mountPath: /etc/pki
name: pki
hostNetwork: true
volumes:
– hostPath:
path: /etc/kubernetes
name: k8s
– hostPath:
path: /etc/ssl/certs
name: certs
– hostPath:
path: /etc/pki
name: pki
b. Ensure that the admission control plugin PodSecurityPolicy is set.
audit: “/bin/ps -ef | grep $apiserverbin | grep -v grep”
tests:
test_items:
– flag: “–enable-admission-plugins”
compare:
op: has
value: “PodSecurityPolicy”
set: true
remediation: |
Follow the documentation and create Pod Security Policy objects as per your environment.
Then, edit the API server pod specification file $apiserverconf
on the master node and set the –enable-admission-plugins parameter to a value that includes PodSecurityPolicy :
–enable-admission-plugins=…,PodSecurityPolicy,…
Then restart the API Server.
scored: true
c. Ensure that the –kubelet-certificate-authority argument is set as appropriate.
audit: “/bin/ps -ef | grep $apiserverbin | grep -v grep”
tests:
test_items:
– flag: “–kubelet-certificate-authority”
set: true
remediation: |
Follow the Kubernetes documentation and setup the TLS connection between the apiserver and kubelets. Then, edit the API server pod specification file
$apiserverconf on the master node and set the –kubelet-certificate-authority parameter to the path to the cert file for the certificate authority.
–kubelet-certificate-authority=<ca-string>
scored: true
Fix all of the following violations that were found against the ETCD:-
a. Ensure that the –auto-tls argument is not set to true
Edit the etcd pod specification file $etcdconf on the master node and either remove the –auto-tls parameter or set it to false. –auto-tls=false b. Ensure that the –peer-auto-tls argument is not set to true Edit the etcd pod specification file $etcdconf on the master node and either remove the –peer-auto-tls parameter or set it to false. –peer-auto-tls=false

NO.25 Create a new NetworkPolicy named deny-all in the namespace testing which denies all traffic of type ingress and egress traffic

You can create a “default” isolation policy for a namespace by creating a NetworkPolicy that selects all pods but does not allow any ingress traffic to those pods.
—
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: default-deny-ingress
spec:
podSelector: {}
policyTypes:
– Ingress
You can create a “default” egress isolation policy for a namespace by creating a NetworkPolicy that selects all pods but does not allow any egress traffic from those pods.
—
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-all-egress
spec:
podSelector: {}
egress:
– {}
policyTypes:
– Egress
Default deny all ingress and all egress traffic
You can create a “default” policy for a namespace which prevents all ingress AND egress traffic by creating the following NetworkPolicy in that namespace.
—
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: default-deny-all
spec:
podSelector: {}
policyTypes:
– Ingress
– Egress
This ensures that even pods that aren’t selected by any other NetworkPolicy will not be allowed ingress or egress traffic.

NO.26 use the Trivy to scan the following images,

 
2. k8s.gcr.io/kube-controller-manager:v1.18.6
Look for images with HIGH or CRITICAL severity vulnerabilities and store the output of the same in /opt/trivy-vulnerable.txt

NO.27 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

Create psp to disallow privileged container
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: deny-access-role
rules:
– apiGroups: [‘policy’]
resources: [‘podsecuritypolicies’]
verbs: [‘use’]
resourceNames:
– “deny-policy”
k create sa psp-denial-sa -n development
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: restrict-access-bing
roleRef:
kind: ClusterRole
name: deny-access-role
apiGroup: rbac.authorization.k8s.io
subjects:
– kind: ServiceAccount
name: psp-denial-sa
namespace: development
Explanation
master1 $ vim psp.yaml
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
name: deny-policy
spec:
privileged: false # Don’t allow privileged pods!
seLinux:
rule: RunAsAny
supplementalGroups:
rule: RunAsAny
runAsUser:
rule: RunAsAny
fsGroup:
rule: RunAsAny
volumes:
– ‘*’
master1 $ vim cr1.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: deny-access-role
rules:
– apiGroups: [‘policy’]
resources: [‘podsecuritypolicies’]
verbs: [‘use’]
resourceNames:
– “deny-policy”
master1 $ k create sa psp-denial-sa -n development master1 $ vim cb1.yaml apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata:
name: restrict-access-bing
roleRef:
kind: ClusterRole
name: deny-access-role
apiGroup: rbac.authorization.k8s.io
subjects:
# Authorize specific service accounts:
– kind: ServiceAccount
name: psp-denial-sa
namespace: development
master1 $ k apply -f psp.yaml master1 $ k apply -f cr1.yaml master1 $ k apply -f cb1.yaml Reference: https://kubernetes.io/docs/concepts/policy/pod-security-policy/

NO.28 You must complete this task on the following cluster/nodes: Cluster: immutable-cluster Master node: master1 Worker node: worker1 You can switch the cluster/configuration context using the following command:
[desk@cli] $ kubectl config use-context immutable-cluster
Context: It is best practice to design containers to be stateless and immutable.
Task:
Inspect Pods running in namespace prod and delete any Pod that is either not stateless or not immutable.
Use the following strict interpretation of stateless and immutable:
1. Pods being able to store data inside containers must be treated as not stateless.
Note: You don’t have to worry whether data is actually stored inside containers or not already.
2. Pods being configured to be privileged in any way must be treated as potentially not stateless or not immutable.

k get pods -n prod
k get pod <pod-name> -n prod -o yaml | grep -E ‘privileged|ReadOnlyRootFileSystem’ Delete the pods which do have any of these 2 properties privileged:true or ReadOnlyRootFileSystem: false
[desk@cli]$ k get pods -n prod
NAME READY STATUS RESTARTS AGE
cms 1/1 Running 0 68m
db 1/1 Running 0 4m
nginx 1/1 Running 0 23m
[desk@cli]$ k get pod nginx -n prod -o yaml | grep -E ‘privileged|RootFileSystem’
{“apiVersion”:”v1″,”kind”:”Pod”,”metadata”:{“annotations”:{},”creationTimestamp”:null,”labels”:{“run”:”nginx”},”name”:”nginx”,”namespace”:”prod”},”spec”:{“containers”:[{“image”:”nginx”,”name”:”nginx”,”resources”:{},”securityContext”:{“privileged”:true}}],”dnsPolicy”:”ClusterFirst”,”restartPolicy”:”Always”},”status”:{}} f:privileged: {} privileged: true

[desk@cli]$ k delete pod nginx -n prod
[desk@cli]$ k get pod db -n prod -o yaml | grep -E ‘privileged|RootFilesystem’

[desk@cli]$ k delete pod cms -n prod Reference: https://kubernetes.io/docs/concepts/policy/pod-security-policy/ https://cloud.google.com/architecture/best-practices-for-operating-containers Reference:
[desk@cli]$ k delete pod cms -n prod Reference: https://kubernetes.io/docs/concepts/policy/pod-security-policy/ https://cloud.google.com/architecture/best-practices-for-operating-containers

NO.29 SIMULATION
Given an existing Pod named test-web-pod running in the namespace test-system Edit the existing Role bound to the Pod’s Service Account named sa-backend to only allow performing get operations on endpoints.
Create a new Role named test-system-role-2 in the namespace test-system, which can perform patch operations, on resources of type statefulsets.
Create a new RoleBinding named test-system-role-2-binding binding the newly created Role to the Pod’s ServiceAccount sa-backend.

 

NO.30 a. Retrieve the content of the existing secret named default-token-xxxxx in the testing namespace.
Store the value of the token in the token.txt
b. Create a new secret named test-db-secret in the DB namespace with the following content:
username: mysql
password: password@123
Create the Pod name test-db-pod of image nginx in the namespace db that can access test-db-secret via a volume at path /etc/mysql-credentials

To add a Kubernetes cluster to your project, group, or instance:
Navigate to your:
Project’s Operations > Kubernetes page, for a project-level cluster.
Group’s Kubernetes page, for a group-level cluster.
Admin Area > Kubernetes page, for an instance-level cluster.
Click Add Kubernetes cluster.
Click the Add existing cluster tab and fill in the details:
Kubernetes cluster name (required) – The name you wish to give the cluster.
Environment scope (required) – The associated environment to this cluster.
API URL (required) – It’s the URL that GitLab uses to access the Kubernetes API. Kubernetes exposes several APIs, we want the “base” URL that is common to all of them. For example, https://kubernetes.example.com rather than https://kubernetes.example.com/api/v1.
Get the API URL by running this command:
kubectl cluster-info | grep -E ‘Kubernetes master|Kubernetes control plane’ | awk ‘/http/ {print $NF}’ CA certificate (required) – A valid Kubernetes certificate is needed to authenticate to the cluster. We use the certificate created by default.
List the secrets with kubectl get secrets, and one should be named similar to default-token-xxxxx. Copy that token name for use below.
Get the certificate by running this command:
kubectl get secret <secret name> -o jsonpath=”{[‘data’][‘ca\.crt’]}”

NO.31 Context: Cluster: prod Master node: master1 Worker node: worker1
You can switch the cluster/configuration context using the following command:
[desk@cli] $ kubectl config use-context prod
Task: Analyse and edit the given Dockerfile (based on the ubuntu:18:04 image) /home/cert_masters/Dockerfile fixing two instructions present in the file being prominent security/best-practice issues.
Analyse and edit the given manifest file /home/cert_masters/mydeployment.yaml fixing two fields present in the file being prominent security/best-practice issues.
Note: Don’t add or remove configuration settings; only modify the existing configuration settings, so that two configuration settings each are no longer security/best-practice concerns. Should you need an unprivileged user for any of the tasks, use user nobody with user id 65535

1. For Dockerfile: Fix the image version & user name in Dockerfile 2. For mydeployment.yaml : Fix security contexts Explanation
[desk@cli] $ vim /home/cert_masters/Dockerfile
FROM ubuntu:latest # Remove this
FROM ubuntu:18.04 # Add this
USER root # Remove this
USER nobody # Add this
RUN apt get install -y lsof=4.72 wget=1.17.1 nginx=4.2
ENV ENVIRONMENT=testing
USER root # Remove this
USER nobody # Add this
CMD [“nginx -d”]

[desk@cli] $ vim /home/cert_masters/mydeployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
app: kafka
name: kafka
spec:
replicas: 1
selector:
matchLabels:
app: kafka
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
app: kafka
spec:
containers:
– image: bitnami/kafka
name: kafka
volumeMounts:
– name: kafka-vol
mountPath: /var/lib/kafka
securityContext:
{“capabilities”:{“add”:[“NET_ADMIN”],”drop”:[“all”]},”privileged”: True,”readOnlyRootFilesystem”: False, “runAsUser”: 65535} # Delete This
{“capabilities”:{“add”:[“NET_ADMIN”],”drop”:[“all”]},”privileged”: False,”readOnlyRootFilesystem”: True, “runAsUser”: 65535} # Add This resources: {} volumes:
– name: kafka-vol
emptyDir: {}
status: {}
Pictorial View: [desk@cli] $ vim /home/cert_masters/mydeployment.yaml

NO.32 Cluster: admission-cluster
Master node: master
Worker node: worker1
You can switch the cluster/configuration context using the following command:
[desk@cli] $ kubectl config use-context admission-cluster
Context:
A container image scanner is set up on the cluster, but it’s not yet fully integrated into the cluster’s configuration. When complete, the container image scanner shall scan for and reject the use of vulnerable images.
Task:
You have to complete the entire task on the cluster’s master node, where all services and files have been prepared and placed.
Given an incomplete configuration in directory /etc/Kubernetes/config and a functional container image scanner with HTTPS endpoint https://imagescanner.local:8181/image_policy:
1. Enable the necessary plugins to create an image policy
2. Validate the control configuration and change it to an implicit deny
3. Edit the configuration to point to the provided HTTPS endpoint correctly Finally, test if the configuration is working by trying to deploy the vulnerable resource /home/cert_masters/test-pod.yml Note: You can find the container image scanner’s log file at /var/log/policy/scanner.log

[master@cli] $ cd /etc/Kubernetes/config
1. Edit kubeconfig to explicity deny
[master@cli] $ vim kubeconfig.json
“defaultAllow”: false # Change to false
2. fix server parameter by taking its value from ~/.kube/config
[master@cli] $cat /etc/kubernetes/config/kubeconfig.yaml | grep server
server:
3. Enable ImagePolicyWebhook
[master@cli] $ vim /etc/kubernetes/manifests/kube-apiserver.yaml
– –enable-admission-plugins=NodeRestriction,ImagePolicyWebhook # Add this
– –admission-control-config-file=/etc/kubernetes/config/kubeconfig.json # Add this Explanation
[desk@cli] $ ssh master
[master@cli] $ cd /etc/Kubernetes/config
[master@cli] $ vim kubeconfig.json
{
“imagePolicy”: {
“kubeConfigFile”: “/etc/kubernetes/config/kubeconfig.yaml”,
“allowTTL”: 50,
“denyTTL”: 50,
“retryBackoff”: 500,
“defaultAllow”: true # Delete this
“defaultAllow”: false # Add this
}
}

Note: We can see a missing value here, so how from where i can get this value
[master@cli] $cat ~/.kube/config | grep server
or
[master@cli] $cat /etc/kubernetes/manifests/kube-apiserver.yaml

[master@cli] $vim /etc/kubernetes/config/kubeconfig.yaml

[master@cli] $ vim /etc/kubernetes/manifests/kube-apiserver.yaml – –enable-admission-plugins=NodeRestriction # Delete This – –enable-admission-plugins=NodeRestriction,ImagePolicyWebhook # Add this – –admission-control-config-file=/etc/kubernetes/config/kubeconfig.json # Add this Reference: https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/
– –enable-admission-plugins=NodeRestriction # Delete This
– –enable-admission-plugins=NodeRestriction,ImagePolicyWebhook # Add this
– –admission-control-config-file=/etc/kubernetes/config/kubeconfig.json # Add this
[master@cli] $ vim /etc/kubernetes/manifests/kube-apiserver.yaml – –enable-admission-plugins=NodeRestriction # Delete This – –enable-admission-plugins=NodeRestriction,ImagePolicyWebhook # Add this – –admission-control-config-file=/etc/kubernetes/config/kubeconfig.json # Add this Reference: https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/

NO.33 You must complete this task on the following cluster/nodes: Cluster: immutable-cluster Master node: master1 Worker node: worker1 You can switch the cluster/configuration context using the following command: [desk@cli] $ kubectl config use-context immutable-cluster Context: It is best practice to design containers to be stateless and immutable. Task: Inspect Pods running in namespace prod and delete any Pod that is either not stateless or not immutable. Use the following strict interpretation of stateless and immutable: 1. Pods being able to store data inside containers must be treated as not stateless. Note: You don’t have to worry whether data is actually stored inside containers or not already. 2. Pods being configured to be privileged in any way must be treated as potentially not stateless or not immutable.



Reference: https://kubernetes.io/docs/concepts/policy/pod-security-policy/ https://cloud.google.com/architecture/best-practices-for-operating-containers

NO.34 Cluster: scanner
Master node: controlplane
Worker node: worker1
You can switch the cluster/configuration context using the following command:
[desk@cli] $ kubectl config use-context scanner
Given:
You may use Trivy’s documentation.
Task:
Use the Trivy open-source container scanner to detect images with severe vulnerabilities used by Pods in the namespace nato.
Look for images with High or Critical severity vulnerabilities and delete the Pods that use those images.
Trivy is pre-installed on the cluster’s master node. Use cluster’s master node to use Trivy.

[controlplane@cli] $ k get pods -n nato -o yaml | grep “image: “
[controlplane@cli] $ trivy image <image-name>
[controlplane@cli] $ k delete pod <vulnerable-pod> -n nato
[desk@cli] $ ssh controlnode
[controlplane@cli] $ k get pods -n nato
NAME READY STATUS RESTARTS AGE
alohmora 1/1 Running 0 3m7s
c3d3 1/1 Running 0 2m54s
neon-pod 1/1 Running 0 2m11s
thor 1/1 Running 0 58s
[controlplane@cli] $ k get pods -n nato -o yaml | grep “image: “

[controlplane@cli] $ k delete pod thor -n nato
[controlplane@cli] $ k delete pod neon-pod -n nato Reference: https://github.com/aquasecurity/trivy
[controlplane@cli] $ k delete pod neon-pod -n nato Reference: https://github.com/aquasecurity/trivy

NO.35 Service is running on port 389 inside the system, find the process-id of the process, and stores the names of all the open-files inside the /candidate/KH77539/files.txt, and also delete the binary.

 

NO.36 SIMULATION
Using the runtime detection tool Falco, Analyse the container behavior for at least 20 seconds, using filters that detect newly spawning and executing processes in a single container of Nginx.
store the incident file art /opt/falco-incident.txt, containing the detected incidents. one per line, in the format
[timestamp],[uid],[processName]

 

NO.37 SIMULATION
Fix all issues via configuration and restart the affected components to ensure the new setting takes effect.
Fix all of the following violations that were found against the API server:- a. Ensure the –authorization-mode argument includes RBAC b. Ensure the –authorization-mode argument includes Node c. Ensure that the –profiling argument is set to false Fix all of the following violations that were found against the Kubelet:- a. Ensure the –anonymous-auth argument is set to false.
b. Ensure that the –authorization-mode argument is set to Webhook.
Fix all of the following violations that were found against the ETCD:-
a. Ensure that the –auto-tls argument is not set to true
Hint: Take the use of Tool Kube-Bench

API server:
Ensure the –authorization-mode argument includes RBAC
Turn on Role Based Access Control. Role Based Access Control (RBAC) allows fine-grained control over the operations that different entities can perform on different objects in the cluster. It is recommended to use the RBAC authorization mode.
Fix – Buildtime
Kubernetes
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
component: kube-apiserver
tier: control-plane
name: kube-apiserver
namespace: kube-system
spec:
containers:
– command:
+ – kube-apiserver
+ – –authorization-mode=RBAC,Node
image: gcr.io/google_containers/kube-apiserver-amd64:v1.6.0
livenessProbe:
failureThreshold: 8
httpGet:
host: 127.0.0.1
path: /healthz
port: 6443
scheme: HTTPS
initialDelaySeconds: 15
timeoutSeconds: 15
name: kube-apiserver-should-pass
resources:
requests:
cpu: 250m
volumeMounts:
– mountPath: /etc/kubernetes/
name: k8s
readOnly: true
– mountPath: /etc/ssl/certs
name: certs
– mountPath: /etc/pki
name: pki
hostNetwork: true
volumes:
– hostPath:
path: /etc/kubernetes
name: k8s
– hostPath:
path: /etc/ssl/certs
name: certs
– hostPath:
path: /etc/pki
name: pki
Ensure the –authorization-mode argument includes Node
Remediation: Edit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml on the master node and set the –authorization-mode parameter to a value that includes Node.
–authorization-mode=Node,RBAC
Audit:
/bin/ps -ef | grep kube-apiserver | grep -v grep
Expected result:
‘Node,RBAC’ has ‘Node’
Ensure that the –profiling argument is set to false
Remediation: Edit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml on the master node and set the below parameter.
–profiling=false
Audit:
/bin/ps -ef | grep kube-apiserver | grep -v grep
Expected result:
‘false’ is equal to ‘false’
Fix all of the following violations that were found against the Kubelet:- Ensure the –anonymous-auth argument is set to false.
Remediation: If using a Kubelet config file, edit the file to set authentication: anonymous: enabled to false. If using executable arguments, edit the kubelet service file /etc/systemd/system/kubelet.service.d/10-kubeadm.conf on each worker node and set the below parameter in KUBELET_SYSTEM_PODS_ARGS variable.
–anonymous-auth=false
Based on your system, restart the kubelet service. For example:
systemctl daemon-reload
systemctl restart kubelet.service
Audit:
/bin/ps -fC kubelet
Audit Config:
/bin/cat /var/lib/kubelet/config.yaml
Expected result:
‘false’ is equal to ‘false’
2) Ensure that the –authorization-mode argument is set to Webhook.
Audit
docker inspect kubelet | jq -e ‘.[0].Args[] | match(“–authorization-mode=Webhook”).string’ Returned Value: –authorization-mode=Webhook Fix all of the following violations that were found against the ETCD:- a. Ensure that the –auto-tls argument is not set to true Do not use self-signed certificates for TLS. etcd is a highly-available key value store used by Kubernetes deployments for persistent storage of all of its REST API objects. These objects are sensitive in nature and should not be available to unauthenticated clients. You should enable the client authentication via valid certificates to secure the access to the etcd service.
Fix – Buildtime
Kubernetes
apiVersion: v1
kind: Pod
metadata:
annotations:
scheduler.alpha.kubernetes.io/critical-pod: “”
creationTimestamp: null
labels:
component: etcd
tier: control-plane
name: etcd
namespace: kube-system
spec:
containers:
– command:
+ – etcd
+ – –auto-tls=true
image: k8s.gcr.io/etcd-amd64:3.2.18
imagePullPolicy: IfNotPresent
livenessProbe:
exec:
command:
– /bin/sh
– -ec
– ETCDCTL_API=3 etcdctl –endpoints=https://[192.168.22.9]:2379 –cacert=/etc/kubernetes/pki/etcd/ca.crt
–cert=/etc/kubernetes/pki/etcd/healthcheck-client.crt –key=/etc/kubernetes/pki/etcd/healthcheck-client.key get foo failureThreshold: 8 initialDelaySeconds: 15 timeoutSeconds: 15 name: etcd-should-fail resources: {} volumeMounts:
– mountPath: /var/lib/etcd
name: etcd-data
– mountPath: /etc/kubernetes/pki/etcd
name: etcd-certs
hostNetwork: true
priorityClassName: system-cluster-critical
volumes:
– hostPath:
path: /var/lib/etcd
type: DirectoryOrCreate
name: etcd-data
– hostPath:
path: /etc/kubernetes/pki/etcd
type: DirectoryOrCreate
name: etcd-certs
status: {}

NO.38 You can switch the cluster/configuration context using the following command: [desk@cli] $ kubectl config use-context dev Context: A CIS Benchmark tool was run against the kubeadm created cluster and found multiple issues that must be addressed. Task: Fix all issues via configuration and restart the affected components to ensure the new settings take effect. Fix all of the following violations that were found against the API server: 1.2.7 authorization-mode argument is not set to AlwaysAllow FAIL 1.2.8 authorization-mode argument includes Node FAIL 1.2.7 authorization-mode argument includes RBAC FAIL Fix all of the following violations that were found against the Kubelet: 4.2.1 Ensure that the anonymous-auth argument is set to false FAIL 4.2.2 authorization-mode argument is not set to AlwaysAllow FAIL (Use Webhook autumn/authz where possible) Fix all of the following violations that were found against etcd: 2.2 Ensure that the client-cert-auth argument is set to true

worker1 $ vim /var/lib/kubelet/config.yaml
anonymous:
enabled: true #Delete this
enabled: false #Replace by this
authorization:
mode: AlwaysAllow #Delete this
mode: Webhook #Replace by this
worker1 $ systemctl restart kubelet. # To reload kubelet config ssh to master1 master1 $ vim /etc/kubernetes/manifests/kube-apiserver.yaml – — authorization-mode=Node,RBAC master1 $ vim /etc/kubernetes/manifests/etcd.yaml – –client-cert-auth=true Explanation ssh to worker1 worker1 $ vim /var/lib/kubelet/config.yaml apiVersion: kubelet.config.k8s.io/v1beta1 authentication:
anonymous:
enabled: true #Delete this
enabled: false #Replace by this
webhook:
cacheTTL: 0s
enabled: true
x509:
clientCAFile: /etc/kubernetes/pki/ca.crt
authorization:
mode: AlwaysAllow #Delete this
mode: Webhook #Replace by this
webhook:
cacheAuthorizedTTL: 0s
cacheUnauthorizedTTL: 0s
cgroupDriver: systemd
clusterDNS:
– 10.96.0.10
clusterDomain: cluster.local
cpuManagerReconcilePeriod: 0s
evictionPressureTransitionPeriod: 0s
fileCheckFrequency: 0s
healthzBindAddress: 127.0.0.1
healthzPort: 10248
httpCheckFrequency: 0s
imageMinimumGCAge: 0s
kind: KubeletConfiguration
logging: {}
nodeStatusReportFrequency: 0s
nodeStatusUpdateFrequency: 0s
resolvConf: /run/systemd/resolve/resolv.conf
rotateCertificates: true
runtimeRequestTimeout: 0s
staticPodPath: /etc/kubernetes/manifests
streamingConnectionIdleTimeout: 0s
syncFrequency: 0s
volumeStatsAggPeriod: 0s
worker1 $ systemctl restart kubelet. # To reload kubelet config ssh to master1 master1 $ vim /etc/kubernetes/manifests/kube-apiserver.yaml

master1 $ vim /etc/kubernetes/manifests/etcd.yaml

NO.39 Context
Your organization’s security policy includes:
ServiceAccounts must not automount API credentials
ServiceAccount names must end in “-sa”
The Pod specified in the manifest file /home/candidate/KSCH00301 /pod-m nifest.yaml fails to schedule because of an incorrectly specified ServiceAccount.
Complete the following tasks:
Task
1. Create a new ServiceAccount named frontend-sa in the existing namespace q a. Ensure the ServiceAccount does not automount API credentials.
2. Using the manifest file at /home/candidate/KSCH00301 /pod-manifest.yaml, create the Pod.
3. Finally, clean up any unused ServiceAccounts in namespace qa.



NO.40 Context:
Cluster: gvisor
Master node: master1
Worker node: worker1
You can switch the cluster/configuration context using the following command:
[desk@cli] $ kubectl config use-context gvisor
Context: This cluster has been prepared to support runtime handler, runsc as well as traditional one.
Task:
Create a RuntimeClass named not-trusted using the prepared runtime handler names runsc.
Update all Pods in the namespace server to run on newruntime.

Find all the pods/deployment and edit runtimeClassName parameter to not-trusted under spec
[desk@cli] $ k edit deploy nginx
spec:
runtimeClassName: not-trusted. # Add this
Explanation
[desk@cli] $vim runtime.yaml
apiVersion: node.k8s.io/v1
kind: RuntimeClass
metadata:
name: not-trusted
handler: runsc
[desk@cli] $ k apply -f runtime.yaml
[desk@cli] $ k get pods
NAME READY STATUS RESTARTS AGE
nginx-6798fc88e8-chp6r 1/1 Running 0 11m
nginx-6798fc88e8-fs53n 1/1 Running 0 11m
nginx-6798fc88e8-ndved 1/1 Running 0 11m
[desk@cli] $ k get deploy
NAME READY UP-TO-DATE AVAILABLE AGE
nginx 3/3 11 3 5m
[desk@cli] $ k edit deploy nginx

NO.41 SIMULATION
On the Cluster worker node, enforce the prepared AppArmor profile
#include <tunables/global>
profile docker-nginx flags=(attach_disconnected,mediate_deleted) {
#include <abstractions/base>
network inet tcp,
network inet udp,
network inet icmp,
deny network raw,
deny network packet,
file,
umount,
deny /bin/** wl,
deny /boot/** wl,
deny /dev/** wl,
deny /etc/** wl,
deny /home/** wl,
deny /lib/** wl,
deny /lib64/** wl,
deny /media/** wl,
deny /mnt/** wl,
deny /opt/** wl,
deny /proc/** wl,
deny /root/** wl,
deny /sbin/** wl,
deny /srv/** wl,
deny /tmp/** wl,
deny /sys/** wl,
deny /usr/** wl,
audit /** w,
/var/run/nginx.pid w,
/usr/sbin/nginx ix,
deny /bin/dash mrwklx,
deny /bin/sh mrwklx,
deny /usr/bin/top mrwklx,
capability chown,
capability dac_override,
capability setuid,
capability setgid,
capability net_bind_service,
deny @{PROC}/* w, # deny write for all files directly in /proc (not in a subdir)
# deny write to files not in /proc/<number>/** or /proc/sys/**
deny @{PROC}/{[^1-9],[^1-9][^0-9],[^1-9s][^0-9y][^0-9s],[^1-9][^0-9][^0-9][^0-9]*}/** w, deny @{PROC}/sys/[^k]** w, # deny /proc/sys except /proc/sys/k* (effectively /proc/sys/kernel) deny @{PROC}/sys/kernel/{?,??,[^s][^h][^m]**} w, # deny everything except shm* in /proc/sys/kernel/ deny @{PROC}/sysrq-trigger rwklx, deny @{PROC}/mem rwklx, deny @{PROC}/kmem rwklx, deny @{PROC}/kcore rwklx, deny mount, deny /sys/[^f]*/** wklx, deny /sys/f[^s]*/** wklx, deny /sys/fs/[^c]*/** wklx, deny /sys/fs/c[^g]*/** wklx, deny /sys/fs/cg[^r]*/** wklx, deny /sys/firmware/** rwklx, deny /sys/kernel/security/** rwklx,
}
Edit the prepared manifest file to include the AppArmor profile.
apiVersion: v1
kind: Pod
metadata:
name: apparmor-pod
spec:
containers:
– name: apparmor-pod
image: nginx
Finally, apply the manifests files and create the Pod specified on it.
Verify: Try to use command ping, top, sh

 

NO.42 SIMULATION
A container image scanner is set up on the cluster.
Given an incomplete configuration in the directory
/etc/Kubernetes/confcontrol and a functional container image scanner with HTTPS endpoint https://acme.local.8081/image_policy
1. Enable the admission plugin.
2. Validate the control configuration and change it to implicit deny.
Finally, test the configuration by deploying the pod having the image tag as the latest.

 

NO.43 Create a PSP that will only allow the persistentvolumeclaim as the volume type in the namespace restricted.
Create a new PodSecurityPolicy named prevent-volume-policy which prevents the pods which is having different volumes mount apart from persistentvolumeclaim.
Create a new ServiceAccount named psp-sa in the namespace restricted.
Create a new ClusterRole named psp-role, which uses the newly created Pod Security Policy prevent-volume-policy
Create a new ClusterRoleBinding named psp-role-binding, which binds the created ClusterRole psp-role to the created SA psp-sa.
Hint:
Also, Check the Configuration is working or not by trying to Mount a Secret in the pod maifest, it should get failed.
POD Manifest:
apiVersion: v1
kind: Pod
metadata:
name:
spec:
containers:
– name:
image:
volumeMounts:
– name:
mountPath:
volumes:
– name:
secret:
secretName:

apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
name: restricted
annotations:
seccomp.security.alpha.kubernetes.io/allowedProfileNames: ‘docker/default,runtime/default’ apparmor.security.beta.kubernetes.io/allowedProfileNames: ‘runtime/default’ seccomp.security.alpha.kubernetes.io/defaultProfileName: ‘runtime/default’ apparmor.security.beta.kubernetes.io/defaultProfileName: ‘runtime/default’ spec:
privileged: false
# Required to prevent escalations to root.
allowPrivilegeEscalation: false
# This is redundant with non-root + disallow privilege escalation,
# but we can provide it for defense in depth.
requiredDropCapabilities:
– ALL
# Allow core volume types.
volumes:
– ‘configMap’
– ’emptyDir’
– ‘projected’
– ‘secret’
– ‘downwardAPI’
# Assume that persistentVolumes set up by the cluster admin are safe to use.
– ‘persistentVolumeClaim’
hostNetwork: false
hostIPC: false
hostPID: false
runAsUser:
# Require the container to run without root privileges.
rule: ‘MustRunAsNonRoot’
seLinux:
# This policy assumes the nodes are using AppArmor rather than SELinux.
rule: ‘RunAsAny’
supplementalGroups:
rule: ‘MustRunAs’
ranges:
# Forbid adding the root group.
– min: 1
max: 65535
fsGroup:
rule: ‘MustRunAs’
ranges:
# Forbid adding the root group.
– min: 1
max: 65535
readOnlyRootFilesystem: false

NO.44 Using the runtime detection tool Falco, Analyse the container behavior for at least 20 seconds, using filters that detect newly spawning and executing processes in a single container of Nginx.

 
[timestamp],[uid],[processName]

NO.45 A container image scanner is set up on the cluster.
Given an incomplete configuration in the directory
/etc/Kubernetes/confcontrol and a functional container image scanner with HTTPS endpoint https://acme.local.8081/image_policy

 
2. Validate the control configuration and change it to implicit deny.
Finally, test the configuration by deploying the pod having the image tag as the latest.

Loading ... Loading …

Loading

The CKS exam is designed to test the security skills of individuals who work with Kubernetes clusters, including system administrators, developers, and security professionals. The exam is intended to validate an individual’s ability to secure Kubernetes clusters and the applications that run on them, as well as their understanding of best practices for securing Kubernetes environments.

 

New 2023 Realistic Free Linux Foundation CKS Exam Dump Questions and Answer: https://www.free4dump.com/CKS-braindumps-torrent.html

         

Related Links: myportal.utt.edu.tt myportal.utt.edu.tt myportal.utt.edu.tt myportal.utt.edu.tt myportal.utt.edu.tt myportal.utt.edu.tt

Tags: CKS accurate prep material CKS instant download CKS latest exam questions fee CKS new exam cram sheet file CKS reliable practice questions files CKS reliable test objectives CKS valid practice questions free

Post navigation

❮ Previous Post: [Q25-Q49] Get 100% Passing Success With True HPE2-W07 Exam! [Apr-2023]
Next Post: [Q53-Q73] Latest JN0-222 Exam with Accurate Automation and DevOps, Associate (JNCIA-DevOps) PDF Questions [May 01, 2023] ❯

You may also like

KCNA
[Feb-2023] KCNA Dumps Full Questions – Kubernetes Cloud Native Associate Exam Study Guide [Q34-Q49]
February 27, 2023

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Enter the text from the image below
 

CKS Practice Tests

  • [2023] CKS Answers CKS Free Demo Are Based On The Real Exam [Q22-Q45]

Related Certifications

  • KCNA (1)
  • CKS (1)

Recent Posts

  • Ace PCPP-32-101 Certification with 71 Actual Questions [Q41-Q65]
  • [Sep 27, 2026] Get Latest and 100% Accurate Databricks-Machine-Learning-Professional Exam Questions [Q36-Q51]
  • ISA-IEC-62443 Premium PDF & Test Engine Files with 221 Questions & Answers [Q87-Q107]
  • [Sep-2026] ITILFND_V4 Exam Dumps – Free Demo & 365 Day Updates [Q44-Q60]
  • New (2026) Network Appliance NS0-194 Exam Dumps [Q37-Q53]

Archives

  • September 2026 (17)
  • August 2026 (20)
  • July 2026 (9)
  • May 2026 (10)
  • April 2026 (8)
  • March 2026 (23)
  • February 2026 (23)
  • January 2026 (13)
  • December 2025 (22)
  • November 2025 (2)
  • October 2025 (4)
  • September 2025 (9)
  • August 2025 (8)
  • July 2025 (5)
  • April 2025 (6)
  • March 2025 (10)
  • February 2025 (16)
  • January 2025 (18)
  • December 2024 (10)
  • November 2024 (14)
  • October 2024 (19)
  • September 2024 (7)
  • August 2024 (4)
  • July 2024 (13)
  • June 2024 (22)
  • May 2024 (11)
  • April 2024 (4)
  • March 2024 (18)
  • February 2024 (15)
  • January 2024 (29)
  • December 2023 (42)
  • November 2023 (28)
  • October 2023 (24)
  • September 2023 (20)
  • August 2023 (14)
  • July 2023 (18)
  • June 2023 (17)
  • May 2023 (19)
  • April 2023 (30)
  • March 2023 (13)
  • February 2023 (28)
  • January 2023 (23)
  • December 2022 (36)
  • November 2022 (21)
  • October 2022 (21)
  • September 2022 (16)
  • August 2022 (35)
  • July 2022 (29)
  • June 2022 (33)

Categories

  • A10 Networks (1)
  • AACE International (1)
  • AACN (1)
  • ACAMS (4)
  • ACT (1)
  • Adobe (11)
  • AFP (1)
  • AGA (1)
  • AICPA (1)
  • Alibaba Cloud (2)
  • Amazon (16)
  • APMG-International (3)
  • ASIS (1)
  • ASQ (5)
  • ATLASSIAN (2)
  • Avaya (3)
  • BACB (1)
  • BCS (7)
  • BICSI (2)
  • Blue Prism (1)
  • Broadcom (1)
  • Business Architecture Guild (1)
  • CCE Global (1)
  • Certinia (1)
  • CertNexus (2)
  • CheckPoint (1)
  • CIDQ (1)
  • CIMA (6)
  • CIPS (2)
  • Cisco (39)
  • CISI (1)
  • Citrix (3)
  • CIW (1)
  • Cloud Security Alliance (1)
  • CloudBees (1)
  • College Admission (1)
  • CompTIA (15)
  • Confluent (1)
  • CWNP (1)
  • DAMA (1)
  • Databricks (5)
  • Docker (1)
  • EC-COUNCIL (6)
  • ECCouncil (2)
  • EMC (10)
  • EXIN (6)
  • F5 (2)
  • Facebook (2)
  • FINRA (1)
  • Forescout (1)
  • Fortinet (21)
  • GAQM (4)
  • GED (1)
  • Genesys (2)
  • GIAC (2)
  • Google (5)
  • H3C (1)
  • HashiCorp (2)
  • Hitachi (3)
  • HP (19)
  • HRCI (1)
  • Huawei (42)
  • IAPP (6)
  • IBM (12)
  • IIA (3)
  • IIBA (3)
  • IICRC (1)
  • ISACA (6)
  • ISC (5)
  • ISM (1)
  • ISQI (4)
  • Juniper (16)
  • Linux Foundation (2)
  • Lpi (3)
  • Maryland Insurance Administration (1)
  • Medical Professional (1)
  • Microsoft (38)
  • MikroTik (1)
  • MuleSoft (3)
  • NACE (1)
  • NASM (1)
  • NBMTM (1)
  • NCLEX (1)
  • Netskope (1)
  • NetSuite (2)
  • Network Appliance (5)
  • NFPA (1)
  • NICET (1)
  • NSCA (1)
  • Nutanix (11)
  • OCEG (1)
  • OMG (1)
  • Oracle (45)
  • Palo Alto Networks (7)
  • PCI SSC (1)
  • PECB (2)
  • Pegasystems (5)
  • PMI (5)
  • PRINCE2 (2)
  • PRMIA (1)
  • Python Institute (3)
  • Qlik (3)
  • RedHat (1)
  • RUCKUS (1)
  • Salesforce (78)
  • SAP (180)
  • Scrum (10)
  • ServiceNow (12)
  • Shared Assessments (2)
  • Sitecore (2)
  • Snowflake (5)
  • Splunk (4)
  • Symantec (1)
  • Tableau (5)
  • The Open Group (2)
  • Tibco (1)
  • Trend (1)
  • Uncategorized (34)
  • Veeam (1)
  • VMware (15)
  • WGU (3)
  • Workday (1)
  • WorldatWork (1)
  • DMCA
  • Privacy Policy
  • Contact now

Copyright © 2026 Free certification exam prep.

Theme: Oceanly News by ScriptsTown