DevOps Containerization & Kubernetes 1 — Questions and Answers
Question 1: What is the primary purpose of a Docker container?
- To package an application with its dependencies into an isolated runtime environment (Correct answer)
- To replace virtual machines entirely
- To provide persistent database storage
- To manage network routing between services
Correct answer: To package an application with its dependencies into an isolated runtime environment
A Docker container bundles application code, runtime, libraries, and configuration so it runs consistently across different environments.
Question 2: What is a Kubernetes Pod?
- The smallest deployable unit in Kubernetes, containing one or more containers (Correct answer)
- A physical server in a Kubernetes cluster
- A Kubernetes configuration file
- A network policy object
Correct answer: The smallest deployable unit in Kubernetes, containing one or more containers
A Pod is the smallest unit in Kubernetes, wrapping one or more tightly coupled containers that share network and storage.
Question 3: What does a Kubernetes Deployment object manage?
- The desired state and rolling updates of a set of Pods (Correct answer)
- Persistent storage volumes
- Network ingress rules
- Cluster authentication
Correct answer: The desired state and rolling updates of a set of Pods
A Deployment declaratively manages a ReplicaSet, ensuring the specified number of Pod replicas run and enabling rolling updates and rollbacks.
Question 4: What is the role of etcd in a Kubernetes cluster?
- The distributed key-value store that holds all cluster state and configuration (Correct answer)
- The container runtime engine
- The DNS resolver for services
- The node resource scheduler
Correct answer: The distributed key-value store that holds all cluster state and configuration
etcd is the backing store for all Kubernetes cluster data, including desired and actual state of all objects.
Question 5: What does the `kubectl apply` command do?
- Creates or updates Kubernetes resources defined in a YAML/JSON manifest (Correct answer)
- Deletes all resources in a namespace
- Restarts all Pods in a Deployment
- Scales a Deployment to zero replicas
Correct answer: Creates or updates Kubernetes resources defined in a YAML/JSON manifest
`kubectl apply` uses declarative configuration to create or update resources, only changing what differs from the current state.
Question 6: What is a Kubernetes Service?
- A stable network endpoint that routes traffic to a set of Pods (Correct answer)
- A background task runner
- A configuration management object
- A Persistent Volume binding
Correct answer: A stable network endpoint that routes traffic to a set of Pods
A Service provides a stable virtual IP and DNS name for a set of Pods, enabling reliable discovery and load balancing.
What is the primary purpose of a Docker container?