1. Create a Deployment and Expose It as a NodePort Service
Creating the Deployment
First, create a deployment named my-webapp with the following parameters:- Image: nginx
- Replicas: 2
- Label: tier=front end (as implied)
my-webapp.yaml:
Exposing the Deployment as a Service
Next, expose the my-webapp deployment as a NodePort service with these settings:- Service Name: front-end-service
- Service Type: NodePort
- Port: 80
- Node Port: 30083 (to be set manually in the YAML)
front-end-service.yaml and add the node port configuration (30083) under the appropriate section. Then, apply the updated configuration:

2. Add a Taint to a Node and Create a Pod with a Toleration
Tainting the Node
Check the nodes in your cluster:app_type, value alpha, and effect NoSchedule:
Creating the Pod with Toleration
Create a pod named alpha using theredis image. First, generate the pod’s YAML configuration:
alpha.yaml file to include the following toleration under the pod spec:

3. Label the Control Plane Node and Create a Deployment with Node Affinity
Labeling the Node
List your nodes to find the control plane node:app_type=beta:
Creating the Beta-Apps Deployment with Node Affinity
Create a deployment named beta-apps with the following settings:- Image: nginx
- Replicas: 3
4. Create an Ingress Resource for the My-Video Service
First, verify the my-video-service details (it listens on port 8080):ckad-mock-exam-solution.com at the path /video.
Generate the ingress configuration imperatively:

5. Update a Pod with a Readiness Probe
Update a pod (named pod-with-rprobe) to include a readiness probe. First, retrieve its current configuration:pod.yaml and insert the following snippet under the container spec (before the ports section):
6. Create a Pod with a Liveness Probe
Create a new pod named nginx1401 in the default namespace using the nginx image. This pod will have a liveness probe that executes a command to check/var/www/html/probe. The probe has an initial delay of 10 seconds and executes every 60 seconds.
Create a file called nginx1401.yaml with the following content:
If validation errors occur, verify the YAML formatting and ensure the liveness probe is directly placed under the container.

7. Create a Job Called Whalesay
Create a Kubernetes Job named whalesay using thedocker/whalesay image. This job will execute a command to display “I am going to ace CKAD!”, with 10 completions, a backoff limit of 6, and a restart policy set to Never.
Generate the job configuration using a dry run:
whalesay.yaml file to include the completions and backoffLimit fields. The finalized YAML should be:

8. Create a Multi-Container Pod
Create a pod named multi-pod containing two containers with the configurations below:- Container 1:
- Name: jupiter
- Image: nginx
- Environment Variable:
type=planet
- Container 2:
- Name: europa
- Image: busybox
- Command:
/bin/sh -c "sleep 4800" - Environment Variable:
type=moon
multi-pod.yaml with the following content:
9. Create a Persistent Volume
Create a persistent volume named custom-volume with these attributes:- Storage: 50Mi
- Reclaim Policy: Retain
- Access Modes: ReadWriteMany
- Host Path: /opt/data
pv.yaml with the configuration below:

This concludes the mock exam solutions. Verify each resource with the appropriate kubectl commands to ensure all configurations are applied successfully. Enjoy scaling your Kubernetes expertise!