Question 1: Deploy a Pod using the Nginx Alpine Image
Deploy a pod named “nginx-448839” using the Nginx Alpine image:Question 2: Create a Namespace
Create a namespace “apx-Z993845” by running:Question 3: Create a Deployment with Replicas
Create a deployment named “httpd-frontend” using thehttpd:2.4-alpine image and scale it to three replicas:
Question 4: Deploy a Messaging Pod with a Label
Deploy a messaging pod using the Redis Alpine image and assign the labeltier=MSG:
Question 5: Fix the ReplicaSet with Invalid Image Name
A ReplicaSet namedrs-d33393 is not launching pods due to a typo in the image name. Follow these steps to fix the issue:
-
Check the ReplicaSet status:
-
Describe the ReplicaSet to diagnose the problem:
Look for the container image field to identify the typo (
busyboxXXXXXXXX instead of busybox).-
Edit the ReplicaSet to correct the image name:
In the YAML, change:toAlso, update the number of replicas to 4 by ensuring:
-
Delete the misconfigured pods to allow the ReplicaSet to recreate them. First, list all pods:
Then, delete pods with the label
name=busybox-pod: -
Verify that the ReplicaSet now has 4 ready pods:
Expected output:
Question 6: Expose the Redis Deployment via a Service
Expose the Redis deployment in themarketing namespace by creating a service called “messaging-service” on port 6379:
Question 7: Update the Environment Variable on a Pod
The podwebapp-color has an environment variable APP_COLOR set to pink. Update it to green by following these steps:
-
Export the pod configuration to a YAML file:
-
Open
webapp-color.yamlin your preferred editor and locate the environment variable section. Replace:with -
Apply the updated configuration by replacing the pod:
Question 8: Create a ConfigMap with Key-Value Pairs
Create a ConfigMap named “cm-3392845” with the following key-value pairs:- DB_NAME: SQL3322
- DB_HOST: sql322.mycompany.com
- DB_PORT: 3306
Question 9: Create a Secret with Given Data
Create a secret named “db-secret” with the specified key-value pairs:Question 10: Update a Pod to Run as Root with SYS_TIME Capability
For the podapp-sec-kff3345, update the security context to run as root and enable the SYS_TIME capability:
-
Export the pod configuration to a YAML file:
-
Edit
app-sec.yamlwith the following modifications:-
Under
spec.securityContext, setrunAsUser: 0: -
Under the container section (e.g., container “ubuntu”), add a security context to include the
SYS_TIMEcapability:
-
Under
-
Apply the updated configuration by replacing the pod:
Question 11: Export Pod Logs to a File
Export the logs of pode-com-1123 in the e-commerce namespace to a file:
Question 12: Create a Persistent Volume
Create a Persistent Volume named “pv-analytics” with the specified details:- Capacity: 100Mi
- Access mode: ReadWriteMany
- Host path: /PV/data-analytics
pv.yaml with the following content:
Question 13: Create a Redis Deployment and Expose It
-
Create a deployment named “redis” using the
redis:alpineimage with one replica: -
Expose the deployment with a ClusterIP service on port 6379:
Question 14: Create a Network Policy for Redis Access
Allow traffic to Redis only from pods with the labelaccess=redis by creating a network policy. Create a file named networkpolicy.yaml with the following content:
Question 15: Create a Pod with Two Containers
Create a pod named “sega” that includes two containers:- Container “tails”: uses the
busyboximage and runs a sleep command for 3600 seconds. - Container “sonic”: uses the
nginximage and sets the environment variableNGINX_PORTto “8080”.
sega.yaml with the following content:
That concludes the steps for Mock Exam 1. Each section documents the command or configuration change required. Happy deploying!