Scenario III
1.
You are deploying a microservices application, and you need a way to route external traffic to different services based on the path. What Kubernetes resource allows you to achieve this?
Ingress
Service
NodePort
LoadBalancer
2.
You need to expose a Kubernetes Service externally with an automatically assigned external IP address. What service type should you use?
LoadBalancer
NodePort
ClusterIP
ExternalIP
3.
You have a Kubernetes Deployment, and you need to roll back to a specific revision due to issues with the latest update. What imperative command should you use?
kubectl rollout undo deployment my-deployment
kubectl rollout history deployment my-deployment
kubectl apply -f deployment-definition.yaml
kubectl rollback deployment my-deployment
4.
Your team is deploying a web application, and you need to expose it externally using a specific DNS name. What Kubernetes resource allows you to define these external access rules, including DNS names?
Ingress
Service
LoadBalancer
NodePort
5.
You need to expose a Kubernetes Deployment externally using a specific port. What imperative command should you use?
kubectl expose deployment my-deployment --type=NodePort --port=8080
kubectl create service nodeport my-deployment --tcp=8080:8080
kubectl apply -f service-definition.yaml
kubectl expose deployment my-deployment --type=NodePort --target-port=8080
6.
You are deploying a web application, and you need to expose it externally using a specific DNS name and SSL termination. What Kubernetes resource allows you to achieve this?
Ingress
Service
LoadBalancer
NodePort
7.
You have a Kubernetes Deployment, and you need to scale it down to zero replicas temporarily. What imperative command should you use?
kubectl scale deployment my-deployment --replicas=0
kubectl resize deployment my-deployment --replicas=0
kubectl set replicas deployment my-deployment --replicas=0
kubectl edit deployment my-deployment --replicas=0
8.
Your team is deploying a stateful application in Kubernetes, and you need to ensure that the Pods have unique and stable network identities. What Kubernetes resource should you use?
StatefulSet
ReplicaSet
DaemonSet
Pod
9.
You have a Kubernetes Pod named 'db-pod' with a container named 'database-container.' You need to execute a command 'mysql -u root -p' within the 'database-container.' What imperative command should you use?
kubectl exec -it db-pod -c database-container -- mysql -u root -p
kubectl run db-pod --image=mysql -- mysql -u root -p
kubectl exec -it db-pod -- mysql -u root -p
kubectl create pod db-pod --image=mysql -- mysql -u root -p
10.
Your team is deploying a set of Pods, and you want to ensure that they run on nodes with specific labels. What Kubernetes feature allows you to achieve this?
Node affinity
Pod affinity
NodeSelector
PodSelector
11.
You have a Pod named 'api-pod' that is running multiple containers. You need to copy a file named 'data.txt' from your local machine to the '/app' directory in the 'app-container.' What imperative command should you use?
kubectl cp data.txt api-pod:/app -c app-container
kubectl copy data.txt api-pod:/app -c app-container
kubectl scp data.txt api-pod:/app -c app-container
kubectl upload data.txt api-pod:/app -c app-container
12.
Your application requires access to sensitive information, such as API keys. What Kubernetes resource is best suited for securely managing and providing access to these secrets?
Secret
ConfigMap
ServiceAccount
Role
13.
You are deploying a set of microservices, and you want to ensure that specific services always run on the same node. What Kubernetes feature allows you to achieve this?
PodAffinity
NodeAffinity
PodAntiAffinity
PodSelector
14.
You need to check the resource utilization of a Pod named 'monitor-pod' and view the CPU and memory metrics. What imperative command should you use?
kubectl top pod monitor-pod
kubectl describe pod monitor-pod
kubectl get resources monitor-pod
kubectl logs monitor-pod
15.
You have a Pod named 'backend-pod' with multiple containers, and you need to execute a command 'tail -f /var/log/app.log' within the 'app-container.' What imperative command should you use?
kubectl exec -it backend-pod -c app-container -- tail -f /var/log/app.log
kubectl logs -f backend-pod -c app-container
kubectl exec backend-pod -- tail -f /var/log/app.log
kubectl run backend-pod --image=ubuntu -- tail -f /var/log/app.log
16.
You have a Kubernetes Cluster, and you need to create a new namespace named 'prod.' What imperative command should you use?
kubectl create namespace prod
kubectl apply -f namespace-definition.yaml
kubectl new namespace prod
kubectl namespace create prod
17.
Your team is deploying a set of microservices, and you need to ensure that certain services do not run on the same node for improved fault tolerance. What Kubernetes feature allows you to achieve this?
PodAntiAffinity
NodeAffinity
PodAffinity
PodSelector
18.
You have a Kubernetes Deployment, and you need to update the image of the containers to a new version named 'v2.' What imperative command should you use?
kubectl set image deployment/my-deployment my-container=my-image:v2
kubectl edit deployment my-deployment
kubectl apply -f deployment-definition.yaml
kubectl rollout update deployment my-deployment --image=my-image:v2
19.
You have a Pod named 'worker-pod' running multiple containers, and you need to execute a command 'python script.py' within the 'python-container.' What imperative command should you use?
kubectl exec worker-pod -c python-container -- python script.py
kubectl run worker-pod --image=python -- python script.py
kubectl exec worker-pod -- python script.py
kubectl create pod worker-pod --image=python -- python script.py
20.
You have a Pod named 'app-pod' with an outdated image, and you need to update it with a new image named 'new-image:latest.' What imperative command should you use?
kubectl set image pod/app-pod my-container=new-image:latest
kubectl edit pod app-pod
kubectl apply -f pod-definition.yaml
kubectl rollout update pod app-pod --image=new-image:latest