Kubernetes, also known as K8s, is an open-source system for automating the deployment, scaling, and management of containerized applications. With its increasing popularity in cloud-native deployments, it’s crucial to understand its fundamental concepts. Dive into this set of 25 multiple-choice questions to test and expand your Kubernetes knowledge!
1. What is Kubernetes?
Answer:
Explanation:
Kubernetes is a platform designed to automate deploying, scaling, and operating application containers.
2. Which Kubernetes object provides declarative updates for Pods and ReplicaSets?
Answer:
Explanation:
Deployments are high-level objects that manage the desired state of an application, ensuring specified numbers of Pods and ReplicaSets are maintained.
3. What is a Pod in Kubernetes?
Answer:
Explanation:
A Pod represents a single unit of deployment and can encapsulate one or more containers.
4. Which Kubernetes component schedules the pods to worker nodes?
Answer:
Explanation:
The Scheduler is responsible for placing Pods onto Nodes based on factors like resources and affinity rules.
5. What do you use to communicate with a Kubernetes cluster?
Answer:
Explanation:
kubectl is the command-line tool used to interact with the Kubernetes cluster.
6. Which Kubernetes component provides a REST interface for tasks like starting and stopping pods?
Answer:
Explanation:
The kube-apiserver exposes the Kubernetes API, which provides the front end for the cluster's shared state through which all other components interact.
7. What is the primary role of the 'etcd' in a Kubernetes cluster?
Answer:
Explanation:
etcd is a consistent and highly-available key-value store used by Kubernetes to store all cluster data.
8. Which Kubernetes object can you use to ensure that there are always a specified number of replica Pods running?
Answer:
Explanation:
ReplicaSet ensures that a specified number of replica Pods are running at any given time.
9. In Kubernetes, which object is used to create a gateway for inbound traffic to your cluster?
Answer:
Explanation:
Ingress manages external access to the services in a cluster, typically HTTP.
10. What is the role of a 'Service' in Kubernetes?
Answer:
Explanation:
Services enable communication between various components within and outside of the application. It abstracts the way to access the Pods, providing a stable endpoint.
11. Which of the following is a container runtime used by Kubernetes?
Answer:
Explanation:
Docker is a container runtime that Kubernetes can use to run containers. Other runtimes include containerd and CRI-O.
12. Which Kubernetes command is used to list all the pods in the current namespace?
Answer:
Explanation:
13. If a Node in Kubernetes becomes unresponsive, what will happen to the pods running on that node?
Answer:
Explanation:
If a node becomes unresponsive, the pods on that node are deemed lost. Kubernetes reschedules these pods onto a healthy node.
14. What is a 'namespace' in Kubernetes?
Answer:
Explanation:
Namespaces are used to provide scope for names and can be used to divide cluster resources among multiple users.
15. Which tool can be used for package management in Kubernetes?
Answer:
Explanation:
Helm is the package manager for Kubernetes that allows developers and operators to more easily configure and deploy applications on Kubernetes clusters.
16. Which command is used to deploy an application from a manifest file named "deployment.yaml"?
Answer:
Explanation:
The kubectl apply command is used to apply a configuration change to a resource from a file or stdin.
17. How can you get the logs of a specific pod?
Answer:
Explanation:
The kubectl logs command is used to retrieve logs from a specific pod.
18. What does 'K8s' stand for?
Answer:
Explanation:
'K8s' is a numeronym for Kubernetes, where 8 stands for the number of letters between K and s.
19. Which command initializes a Kubernetes master node?
Answer:
Explanation:
kubeadm init is used to bootstrap the Kubernetes master node.
20. Which of the following is a best practice for storing secrets in Kubernetes?
Answer:
Explanation:
Kubernetes 'Secret' object allows for more control over how sensitive information is stored and can be updated without redeploying pods.
21. How can you scale a deployment in Kubernetes?
Answer:
Explanation:
The kubectl scale command allows you to adjust the number of replicas in a deployment.
22. Which Kubernetes feature allows you to automatically adjust the number of pod replicas based on CPU utilization or other select metric?
Answer:
Explanation:
HPA automatically scales the number of pods in a deployment or replica set based on observed metrics like CPU utilization.
23. Which command provides detailed information about a specific resource or group of resources in Kubernetes?
Answer:
Explanation:
The kubectl describe command provides detailed information about resources, including events associated with the resources.
24. How would you retrieve a list of all nodes in the cluster?
Answer:
Explanation:
The kubectl get nodes command provides a list of all nodes that belong to a Kubernetes cluster.
25. If you want to delete a service named "my-service", which command would you use?
Answer:
Explanation:
The kubectl delete command is used to delete resources either from a file, stdin, or specifying labels, names, resource selectors, or resources.