Exam CKAD Topic 3 Question 63 Discussion

Actual exam question for Linux Foundation's CKAD exam
Question #: 63
Topic #: 3
You are running a web application on Kubernetes, and you need to schedule a daily backup of your application's dat a. The backup process involves running a script that archives the database and uploads it to a remote storage service. Explain how you would implement this using a CronJ0b in Kubernetes. Provide a sample YAML configuration for the Cronjob.

Suggested Answer:

See the solution below with Step by Step Explanation.
Explanation:
Solution (Step by Step) :
1. Create a Container Image:
- Create a Dockerfile that packages the backup script and any necessary dependencies into a container image-
- Build tne image and push it to a container registry (e.g., Docker Hub).
dockefflle
FROM ubuntu:latest
# Install necessary packages
RUN apt-get update && apt-get install -y zip
# Copy the backup script to the container
COPY backup.sh 'backup.sh
# Set entrypoint to the backup script
ENTRYPOINT ["/backup.sh"]
2. Create the CronJob YAML:
- Define the 'cronJob' resource in a YAML file. Specify the schedule, the container image, and the command to run.

3. Apply the CronJob: - Apply the YAML file to your Kubernetes cluster using 'kubectl apply -f cronjob.yamr 4. Verification: - Use 'kubectl get cronjobs' to check if the CronJob was successfully created- - Check the Kubernetes logs for the CronJob to ensure it's running as expected.

by Vera at Oct 01, 2025, 05:26 AM

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Nick name: Submit Cancel
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

0
0
0
10