EMT Practice Test

1. Question Content...


Question List

Question1: // Create a configmap
kubectl create configmap redis-config --from-file=/opt/redisconfig
// Verify
kubectl get configmap redis-config -o yaml
// first run this command to save the pod yml
kubectl run redis-pod --image=redis --restart=Always --dry-run
-o yaml > redis-pod.yml
// edit the yml to below file and create
apiVersion: v1
kind: Pod
metadata:
name: redis
spec:
containers:
- name: redis
image: redis
env:
- name: MASTER
value: "true"
ports:
- containerPort: 6379
volumeMounts:
- mountPath: /redis-master-data
name: data
- mountPath: /redis-master
name: config
volumes:
- name: data
emptyDir: {}
- name: config
configMap:
name: example-redis-config

Question2: Check nodes which are ready and print it to a file /opt/nodestatus

Question3: Create a file called "config.txt" with two values key1=value1
and key2=value2. Then create a configmap named "keyvalcfgmap" andread data from the file "config.txt" and verify that configmap is created correctly

Question4: Create a namespace called 'development' and a pod with image nginx called nginx on this namespace.

Question5: Create a secret mysecret with values user=myuser and password=mypassword

Question6: Get all the pods with label "env"

Question7: Create a Pod with three busy box containers with commands "ls; sleep 3600;", "echo Hello World; sleep 3600;" and "echo this is the third container; sleep 3600" respectively and check the status

Question8: Create 2 nginx image pods in which one of them is labelled with env=prod and another one labelled with env=dev and verify the same.

Question9: Create a busybox pod which executes this command sleep 3600 with the service account admin and verify

Question10: Create PersistentVolume named task-pv-volume with storage 10Gi, access modes ReadWriteMany, storageClassName manual, and volume at /mnt/data and Create a PersistentVolumeClaim of at least 3Gi storage and access mode ReadWriteOnce and verify

Question11: Deploy a pod with image=redis on a node with label disktype=ssd

Question12: Scale the deployment from 5 replicas to 20 replicas and verify

Question13: List all the pods that are serviced by the service "webservice" and copy the output in /opt/$USER/webservice.targets Note: You need to list the endpoints

Question14: Create a job named "hello-job" with the image busybox which echos "Hello I'm running job"

Question15: Modify "hello-job" and make it run 10 times one after one and 5 times parallelism: 5

Question16: Update the deployment with the image version 1.16.1 and verify the image and check the rollout history

Question17: Create an nginx pod with container Port 80 and it should only receive traffic only it checks the endpoint / on port 80 and verify and delete the pod.

Question18: Get list of PVs and order by size and write to file - /opt/pvlist.txt

Question19: Verify certificate expiry date for ca certificate in /etc/kubernetes/pki

Question20: Resume the rollout of the deployment

Question21: Install a kubernetes cluster with one master and one worker using kubeadm

Question22: Create the service as type NodePort with the port 32767 for the nginx pod with the pod selector app: my-nginx

Question23: Set CPU and memory requests and limits for existing pod name
"nginx-prod".
Set requests for CPU and Memory as 100m and 256Mi respectively
Set limits for CPU and Memory as 200m and 512Mi respectively

Question24: List all configmap and secrets in the cluster in all namespace and write it to a file /opt/configmap-secret

Question25: Create a nginx pod that will be deployed to node with the label
"gpu=true"

Question26: Pause the rollout of the deployment

Question27: Create an nginx pod and set an env value as 'var1=val1'. Check the env value existence within the pod

Question28: Fix a node that shows as non-ready

Question29: Label a node as app=test and verify

Question30: Create a deployment called webapp with image nginx having 5 replicas in it, put the file in /tmp directory with named webapp.yaml

Question31: Evict all existing pods from a node-1 and make the node unschedulable for new pods.

Question32: Print pod name and start time to "/opt/pod-status" file

Question33: Check the Image version of nginx-dev pod using jsonpath

Question34: Create a Pod nginx and specify a CPU request and a CPU limit of 0.5 and 1 respectively.

Question35: Create a redis pod, and have it use a non-persistent storage
Note: In exam, you will have access to kubernetes.io site,
Refer : https://kubernetes.io/docs/tasks/configure-pod-container/configurevolume-storage/

Question36: List the nginx pod with custom columns POD_NAME and POD_STATUS

Question37: Get the number of schedulable nodes and write to a file
/opt/schedulable-nodes.txt

Question38: Get the pods with labels env=dev and env=prod and output the labels as well

Question39: Apply the autoscaling to this deployment with minimum 10 and maximum 20 replicas and target CPU of 85% and verify hpa is created and replicas are increased to 10 from 1

Question40: List pod logs named "frontend" and search for the pattern "started" and write it to a file "/opt/error-logs"

Question41: Annotate the pod with name=webapp