Microservices Containerization and Orchestration 2 — Questions and Answers
Question 1: In Kubernetes, which object ensures a specified number of identical Pod replicas are always running?
- ReplicaSet (Correct answer)
- ConfigMap
- Ingress
- Namespace
Correct answer: ReplicaSet
A ReplicaSet maintains a stable set of replica Pods running at any given time.
Question 2: What is the smallest deployable unit in Kubernetes?
- Container
- Pod (Correct answer)
- Node
- Service
Correct answer: Pod
A Pod is the smallest deployable unit and can contain one or more tightly coupled containers.
Question 3: Which Docker instruction sets the default command executed when a container starts?
- RUN
- COPY
- CMD (Correct answer)
- FROM
Correct answer: CMD
CMD specifies the default command to run when the container launches.
Question 4: What does a Kubernetes Service of type ClusterIP provide?
- A public load balancer IP
- An internal-only stable IP for Pods (Correct answer)
- A node-level port on every host
- External DNS registration
Correct answer: An internal-only stable IP for Pods
ClusterIP exposes the Service on an internal IP reachable only within the cluster.
Question 5: Which command builds a Docker image from a Dockerfile in the current directory?
- docker run .
- docker build . (Correct answer)
- docker pull .
- docker exec .
Correct answer: docker build .
docker build reads the Dockerfile and produces an image.
Question 6: In Kubernetes, what is the purpose of a liveness probe?
- To check if a container should receive traffic
- To restart a container that has become unhealthy (Correct answer)
- To scale Pods based on CPU
- To mount persistent storage
Correct answer: To restart a container that has become unhealthy
A liveness probe detects a stuck container and triggers a restart.
Question 7: Which component is the entry point for all Kubernetes API requests?
- kubelet
- kube-proxy
- kube-apiserver (Correct answer)
- etcd
Correct answer: kube-apiserver
The kube-apiserver is the front end that validates and processes all API requests.
In Kubernetes, which object ensures a specified number of identical Pod replicas are always running?