Skip to main content

CKA 2025 MOCK Q-01 Storage Class

🔶 Question 1: 

Task:
Create a StorageClass named csi-retain-sc with the following specifications:

  • Use provisioner: csi-driver.example-vendor.example

  • Set this class as the default

  • Set reclaimPolicy to Retain

  • Allow volume expansion

  • Add mount option discard

  • Use WaitForFirstConsumer as the volumeBindingMode

✅ Save this configuration to a file named sc-default-retain.yaml and apply it.


🔶 Question 2: 

Task:
You already have a default StorageClass named old-default.
You created a new class fast-csi (already applied) but forgot to mark it as default.

  • Patch fast-csi to be the default StorageClass.

  • Remove the default annotation from old-default.


🔶 Question 3: 

Task:
Create a StorageClass named perf-csi-sc using the same csi-driver.example-vendor.example provisioner but do not make it default.

It must:

  • Allow volume expansion

  • Include the parameter guaranteedReadWriteLatency: "true"

  • Use Immediate volumeBindingMode

  • Use Delete as reclaimPolicy

✅ Save as sc-perf.yaml and apply.


🔶 Question 4: 

Task:
Run a command to identify which StorageClass is currently set as default.

✅ Provide the kubectl command output showing the correct storageclass.kubernetes.io/is-default-class annotation.


🔶 Question 5: 

1. Create a new StorageClass named `cluster-one` with:

   - `rancher.io/local-path'

   - `volumeBindingMode: WaitForFirstConsumer`

2. Mark `cluster-one` as the default StorageClass.

**do not** modify the PVC manifest or any existing Deployments.

🔶 Question 1: Scenario not required

🔶 Question 2: Change Default StorageClass


✅ Scenario Setup

We'll simulate two StorageClasses:

  • old-default (currently default)

  • fast-csi (created but not default)

Apply these two YAMLs:


🔧 old-default.yaml

apiVersion: storage.k8s.io/v1
kind: StorageClass metadata: name: old-default annotations: storageclass.kubernetes.io/is-default-class: "true" # [default] this is current default provisioner: csi-driver.example-vendor.example reclaimPolicy: Delete allowVolumeExpansion: true volumeBindingMode: Immediate

🔧 fast-csi.yaml


apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: fast-csi # No default annotation yet provisioner: csi-driver.example-vendor.example reclaimPolicy: Delete allowVolumeExpansion: true volumeBindingMode: Immediate

Apply both:


kubectl apply -f old-default.yaml kubectl apply -f fast-csi.yaml

Solution

✅ Step 1: Patch fast-csi to become default


kubectl patch storageclass fast-csi \ -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'

✅ Step 2: Remove is-default-class from old-default


kubectl patch storageclass old-default \ -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"false"}}}'

✅ Step 3: Confirm the result


kubectl get sc


🔶 Question 3: Scenario not required

🔶 Question  4: Scenario not required

🔶 Question 5: Scenario not required


Comments

Popular posts from this blog

CKA 2025 MOCK Q -11 TLS

  You’re managing a web server running in a Kubernetes Deployment called secure-site , located in the web-zone namespace. Its NGINX configuration comes from a ConfigMap called site-tls-config . 🧩 Task: Update the ConfigMap ( site-tls-config ) to ensure that only TLS version 1.3 is accepted by the server. Older versions like TLS 1.2 should be blocked completely. Once the ConfigMap is updated: Make sure the secure-site deployment picks up the changes. You might need to restart or roll it out again. Test it with this command: curl --tls-max 1.2 -k https://neokloud.in:32443 The command should fail , because the server should now reject anything below TLSv1.3.   echo "[1/8] Creating namespace: web-zone" kubectl create ns web-zone || true echo "[2/8] Generating TLS certificate for neokloud.in" mkdir -p /tmp/tls && cd /tmp/tls openssl req -x509 -nodes -days 365 \   -newkey rsa:2048 \   -keyout tls.key \   -out tls.crt \   -su...

CKA-2025 MOCK Q-06 PRIORITY

 Generate a PriorityClass named urgent-priority for urgent workloads,  setting the value to 10 less than the highest current user-defined priority class value.  Patch the Deployment mysql-writer in the database namespace to use the urgent-priority class and verify a successful rollout.   Note – Pods from other Deployments in the database namespace should be evicted if resources Cruch kubectl create namespace database # redis-cache Deployment cat <<EOF | kubectl apply -f - apiVersion: apps/v1 kind: Deployment metadata:   name: redis-cache   namespace: database spec:   replicas: 2   selector:     matchLabels:       app: redis-cache   template:     metadata:       labels:         app: redis-cache     spec:       containers:       - name: redis         image: redis:7         resources: ...

CKA 2025 MOCK Q-05 HPA

5 Mock Questions on Horizontal Pod Autoscaler (HPA) 🔶 Question 1: Scale Based on Custom CPU Target and Scale-Up Cooldown You have a Deployment named api-backend in the default namespace. Task: Create an HPA targeting 70% CPU usage Min: 1, Max: 10 replicas Set scale-up cooldown (delay before scaling up again) to 30 seconds File name: hpa-backend.yaml Bonus: Set the HPA to avoid scaling up rapidly even if CPU spikes.   cat <<EOF | kubectl apply -f - apiVersion: apps/v1 kind: Deployment metadata:   name: api-backend   namespace: default spec:   replicas: 2   selector:     matchLabels:       app: api-backend   template:     metadata:       labels:         app: api-backend     spec:       containers:   ...