DEV Community

Cover image for Kubernetes CKAD Exam: Multiple Choice (MCQ)
Caius Sterling
Caius Sterling

Posted on

Kubernetes CKAD Exam: Multiple Choice (MCQ)

Introduction to CKAD Practice Questions

The Certified Kubernetes Application Developer (CKAD) exam is a challenging yet rewarding certification for professionals seeking to showcase their skills in containerized application development using Kubernetes. To help you prepare effectively, having access to quality practice questions is essential. Below, we’ve gathered a set of practice questions from the CKAD Exam Dumps, available through PrepBolt, to give you a glimpse of the type of challenges you'll face in the actual exam. By working through these, you'll gain confidence in solving real-world Kubernetes problems and enhance your exam readiness.

Practice Questions

Question 1: Pod Creation with Redis Image

  • Task: Create a pod that runs in the web namespace with the following characteristics:
    • The pod must be named cache.
    • Use the Ifccncf/redis image with the 3.2 tag.
    • Expose port 6379.
  • Solution: To create the required pod, use the following Kubernetes YAML configuration:
  apiVersion: v1  
  kind: Pod  
  metadata:  
    name: cache  
    namespace: web  
  spec:  
    containers:  
    - name: redis  
      image: Ifccncf/redis:3.2  
      ports:  
      - containerPort: 6379  
Enter fullscreen mode Exit fullscreen mode

Use the command to apply the YAML configuration:

  kubectl apply -f pod-redis.yaml  
Enter fullscreen mode Exit fullscreen mode

Question 2: Secret Creation and Consumption

  • Task: Create a secret named another-secret with the key-value pair key1/value4 and then create an Nginx pod named nginx-secret which consumes the secret in the form of an environment variable named COOL_VARIABLE.
  • Solution: First, create the secret:
  kubectl create secret generic another-secret --from-literal=key1=value4  
Enter fullscreen mode Exit fullscreen mode

Then, create the pod that consumes the secret:

  apiVersion: v1  
  kind: Pod  
  metadata:  
    name: nginx-secret  
  spec:  
    containers:  
    - name: nginx  
      image: nginx  
      env:  
        - name: COOL_VARIABLE  
          valueFrom:  
            secretKeyRef:  
              name: another-secret  
              key: key1  
Enter fullscreen mode Exit fullscreen mode

Apply the configuration:

  kubectl apply -f pod-nginx-secret.yaml  
Enter fullscreen mode Exit fullscreen mode

Question 3: Pod Resource Requests

  • Task: Create a pod named nginx-resources in the pod-resources namespace, with the following resource requirements:
    • A minimum of 200m CPU and 1Gi memory for the container.
    • The pod should use the nginx image.
  • Solution: The YAML for the pod with resource requests looks as follows:
  apiVersion: v1  
  kind: Pod  
  metadata:  
    name: nginx-resources  
    namespace: pod-resources  
  spec:  
    containers:  
    - name: nginx  
      image: nginx  
      resources:  
        requests:  
          memory: "1Gi"  
          cpu: "200m"  
Enter fullscreen mode Exit fullscreen mode

Apply the configuration using:

  kubectl apply -f pod-nginx-resources.yaml  
Enter fullscreen mode Exit fullscreen mode

Question 4: ConfigMap Creation and Usage

  • Task: Create a ConfigMap named another-config with the key-value pair key4/value3. Then, start a pod named nginx-configmap, which mounts this ConfigMap under the directory /also/a/path.
  • Solution: First, create the ConfigMap:
  kubectl create configmap another-config --from-literal=key4=value3  
Enter fullscreen mode Exit fullscreen mode

Then, create the pod that mounts the ConfigMap:

  apiVersion: v1  
  kind: Pod  
  metadata:  
    name: nginx-configmap  
  spec:  
    containers:  
    - name: nginx  
      image: nginx  
      volumeMounts:  
      - name: config-volume  
        mountPath: /also/a/path  
  volumes:  
  - name: config-volume  
    configMap:  
      name: another-config  
Enter fullscreen mode Exit fullscreen mode

Apply the configuration:

  kubectl apply -f pod-nginx-configmap.yaml  
Enter fullscreen mode Exit fullscreen mode

Question 5: Service Account for Deployment

  • Task: Update the deployment app-a in the production namespace to use the restrictedservice service account. The service account has already been created.
  • Solution: To update the app-a deployment to use the restrictedservice service account, modify the deployment YAML:
  apiVersion: apps/v1  
  kind: Deployment  
  metadata:  
    name: app-a  
    namespace: production  
  spec:  
    template:  
      spec:  
        serviceAccountName: restrictedservice  
Enter fullscreen mode Exit fullscreen mode

Apply the update:

  kubectl apply -f deployment-app-a-update.yaml  
Enter fullscreen mode Exit fullscreen mode

By practicing these questions, you can enhance your understanding of Kubernetes concepts, preparing you for success in the CKAD Exam. These questions represent common scenarios you will encounter in the certification process, ensuring you are ready to tackle similar challenges in real-world applications. For further practice and detailed solutions, visit PrepBolt website for comprehensive CKAD study materials.

Top comments (0)