


















































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



















































































Question 1. Which component stores the cluster state in Kubernetes? A) kube-apiserver B) kube-scheduler C) etcd D) kube-controller-manager Answer: C Explanation: etcd is a distributed key‑value store used by Kubernetes to persist all cluster configuration and state data. Question 2. What flag must be set to disable swap on a node before running kubeadm init? A) --fail-swap-on=false B) --ignore-preflight-errors=Swap C) --skip-swap-check=true D) --disable-swap=yes Answer: B Explanation: The kubeadm pre‑flight check can be bypassed for swap by using --ignore- preflight-errors=Swap, but the recommended practice is to disable swap entirely. Question 3. Which static pod manifest directory is used by kubelet to run control‑plane components on a master node? A) /etc/kubernetes/manifests B) /var/lib/kubelet/pods C) /etc/kubernetes/pods D) /var/run/kubernetes/manifests Answer: A Explanation: kubelet watches /etc/kubernetes/manifests and creates static pods for the API server, scheduler, and controller‑manager from the YAML files placed there.
Question 4. When joining a worker node with kubeadm, which token is required? A) Bootstrap token B) Service account token C) Image pull secret D) TLS bootstrap token Answer: A Explanation: kubeadm join uses a bootstrap token generated on the control plane to authenticate the new node during the certificate signing request. Question 5. What file does kubectl use by default to locate cluster credentials and context information? A) /etc/kubernetes/kubeconfig.yaml B) $HOME/.kube/config C) /var/lib/kubelet/kubeconfig D) /usr/local/etc/kube/config Answer: B Explanation: The default kubeconfig location is $HOME/.kube/config, which stores clusters, users, and contexts for kubectl. Question 6. In a stacked etcd topology, where are the etcd data files stored on each control‑plane node? A) /var/lib/etcd B) /etc/etcd/data C) /opt/etcd/db D) /var/run/etcd Answer: A
Explanation: etcdctl --cert=<file> provides the client certificate; --key and --cacert are also required for full TLS authentication. Question 10. A user wants to verify whether they can create Pods in the dev namespace. Which kubectl command should they run? A) kubectl auth can-i create pods --namespace=dev B) kubectl auth check create pods - n dev C) kubectl can-i create pods dev D) kubectl auth verify create pods - n dev Answer: A Explanation: kubectl auth can-i checks permission for a specific verb/resource, with -- namespace to scope the check. Question 11. Which RBAC object grants permissions to a set of users across all namespaces? A) RoleBinding B) ClusterRoleBinding C) Role D) ServiceAccount Answer: B Explanation: ClusterRoleBinding binds a ClusterRole to subjects (users, groups, service accounts) at the cluster level, granting permissions in every namespace. Question 12. What is the primary purpose of a ServiceAccount in a Pod? A) Provide a unique IP address for the Pod B) Supply an identity for the Pod to interact with the API server C) Store persistent data for the Pod
D) Define network policies for the Pod Answer: B Explanation: A ServiceAccount provides a token that the Pod can use to authenticate to the Kubernetes API server. Question 13. Which Kubernetes object is used to define a custom API resource? A) ConfigMap B) CustomResourceDefinition (CRD) C) StatefulSet D) Deployment Answer: B Explanation: A CRD registers a new resource type in the API server, allowing users to create instances of that custom resource. Question 14. An Init Container runs before the main container. Which field specifies its command? A) args B) command C) entrypoint D) initCommand Answer: B Explanation: The command field in the Init Container spec defines the executable that runs before the primary containers start. Question 15. Which controller creates ReplicaSets automatically when a Deployment is applied? A) kube-controller-manager
Question 18. What type of ConfigMap volume mounts the entire ConfigMap as files in a directory? A) configMapRef B) configMapKeyRef C) projected volume D) configMap volume type Answer: D Explanation: A configMap volume type mounts each key in the ConfigMap as a separate file within the specified directory. Question 19. Which Secret type is used to store TLS certificates and keys? A) Opaque B) kubernetes.io/tls C) kubernetes.io/dockerconfigjson D) kubernetes.io/service-account-token Answer: B Explanation: The kubernetes.io/tls Secret type stores a TLS certificate (tls.crt) and private key (tls.key) for use by Ingress or other TLS‑enabled workloads. Question 20. A DaemonSet ensures that a Pod runs on every node. Which field limits it to a subset of nodes? A) nodeSelector B) affinity C) tolerations D) all of the above Answer: D
Explanation: DaemonSet Pods respect nodeSelector, nodeAffinity, and tolerations, allowing you to restrict placement to specific nodes. Question 21. Which object creates a one‑time Pod that runs to completion? A) Deployment B) Job C) CronJob D) DaemonSet Answer: B Explanation: A Job creates Pods that run until they succeed or fail, ensuring a specified number of successful completions. Question 22. How does a CronJob differ from a regular Job? A) It runs multiple Pods simultaneously B) It schedules Jobs based on a cron expression C) It provides automatic rollback capabilities D) It runs only on master nodes Answer: B Explanation: A CronJob creates Job objects on a schedule defined by a cron‑style string. Question 23. Which Kubernetes feature allows you to schedule Pods only on nodes with a specific label? A) NodeSelector B) Taints C) NetworkPolicy D) ServiceAccount Answer: A
D) Ignore the failure Answer: A Explanation: A failing Liveness probe triggers the kubelet to kill the container, which is then restarted according to the restart policy. Question 27. Which Service type allocates a port on each node’s IP address? A) ClusterIP B) NodePort C) LoadBalancer D) ExternalName Answer: B Explanation: NodePort exposes the Service on a static port on every node’s IP, allowing external traffic to reach the Service. Question 28. When a Service of type LoadBalancer is created on a cloud provider, what additional object is automatically created? A) Ingress B) EndpointSlice C) Cloud Load Balancer instance D) ServiceAccount Answer: C Explanation: On supported clouds, Kubernetes provisions an external load balancer (e.g., AWS ELB) and links it to the Service. Question 29. Which object maps a Service name to its cluster IP address? A) Endpoint B) ServiceAccount
C) ConfigMap D) Endpoints object Answer: D Explanation: The Endpoints (or newer EndpointSlice) object holds the IP addresses of Pods backing a Service, enabling DNS resolution. Question 30. What does an ExternalName Service do? A) Creates a load balancer in the cloud B) Provides a DNS alias to an external hostname C) Exposes a Pod via a node port D) Generates a static ClusterIP Answer: B Explanation: ExternalName maps a Service name to an external DNS name, allowing Pods to reach external services using a stable internal name. Question 31. Which component implements the Kubernetes networking model that allows all Pods to communicate without NAT? A) kube-proxy B) CNI plugin (e.g., Calico, Flannel) C) kube-apiserver D) etcd Answer: B Explanation: The Container Network Interface (CNI) plugin provides the underlying network fabric that satisfies the “no‑NAT” requirement. Question 32. If a Pod cannot resolve the DNS name of a Service, which component should you troubleshoot first?
Question 35. A NetworkPolicy that allows traffic only from Pods with label app=frontend in the same namespace is an example of which policy type? A) Ingress only B) Egress only C) Both Ingress and Egress D) No policy (default allow) Answer: A Explanation: Specifying podSelector under ingress restricts inbound traffic; without an egress rule, egress follows the default allow. Question 36. Which PersistentVolume access mode permits multiple nodes to read and write the same volume simultaneously? A) ReadWriteOnce (RWO) B) ReadOnlyMany (ROX) C) ReadWriteMany (RWX) D) ReadWriteOncePod (RWOP) Answer: C Explanation: ReadWriteMany allows concurrent read/write access from many nodes, suitable for shared storage like NFS. Question 37. When a PVC is bound to a PV with Retain reclaim policy, what happens after the PVC is deleted? A) The PV is automatically deleted B) The PV becomes Released but retains its data C) The PV is recycled and reused immediately D) The PV is moved to a backup storage class Answer: B
Explanation: Retain leaves the PV and its data intact; an administrator must manually reclaim or delete the PV. Question 38. Which field in a StorageClass defines the provisioner to be used for dynamic volume creation? A) provisioner B) volumeBindingMode C) reclaimPolicy D) allowVolumeExpansion Answer: A Explanation: The provisioner field specifies the driver (e.g., kubernetes.io/aws-ebs) responsible for creating volumes on demand. Question 39. What does the volumeBindingMode: WaitForFirstConsumer achieve? A) Binds the PV immediately when the PVC is created B) Delays binding until a Pod uses the PVC, allowing topology‑aware scheduling C) Forces the PVC to be bound to the default StorageClass D) Enables dynamic provisioning of hostPath volumes Answer: B Explanation: With WaitForFirstConsumer, the scheduler considers node topology (zone, region) before binding, improving placement decisions. Question 40. Which CSI driver feature allows a pod to expand its PVC after creation? A) VolumeSnapshot B) AllowVolumeExpansion: true in StorageClass C) CSI NodePublishVolume D) TopologySpreadConstraints
C) kubectl get pods - A - o jsonpath='{.items[?(@.status.phase=="Failed")].metadata.name}' D) kubectl get pod --watch --field-selector status.phase=Failed Answer: C Explanation: Using a JSONPath filter on status.phase returns names of Pods whose phase is Failed. Option A is invalid because status.phase is not a field selector for get all. Question 44. When a node shows NotReady status, which systemd service should you first check on the node itself? A) kube-apiserver B) kubelet C) etcd D) containerd Answer: B Explanation: The kubelet reports node health to the control plane; if it’s down or misconfigured, the node becomes NotReady. Question 45. A control‑plane component’s static pod manifest has been edited incorrectly, causing the API server to fail. Which directory holds the manifest that should be corrected? A) /etc/kubernetes/manifests B) /var/lib/kubelet/pods C) /etc/kubernetes/pki D) /usr/local/bin/kube-apiserver.yaml Answer: A Explanation: Static pod manifests reside in /etc/kubernetes/manifests; fixing the YAML there will cause kubelet to recreate the component. Question 46. Which log command retrieves logs from a container that has already terminated?
A) kubectl logs --previous flag fetches logs from the last terminated instance of the container. Question 47. What is the default DNS policy for Pods that do not specify dnsPolicy? A) ClusterFirst B) Default C) None D) ClusterFirstWithHostNet Answer: A Explanation: Pods inherit the ClusterFirst DNS policy, which makes DNS queries go to the cluster DNS (CoreDNS) before falling back to the host resolver. Question 48. A Service’s selector labels do not match any Pods, resulting in no endpoints. Which command can quickly verify the selector? A) kubectl describe svc describe svc shows selectors, get endpoints reveals if any are bound, and get pods - l tests the label query directly.
Explanation: kubectl version --short prints the client and server (control plane) versions; node versions appear with kubectl get nodes. Question 52. If you need to temporarily allow a Pod to be scheduled on a node with a NoExecute taint, which field must you add to the Pod spec? A) tolerations with effect: NoExecute and tolerationSeconds B) nodeSelector matching the node label C) affinity with requiredDuringSchedulingIgnoredDuringExecution D) hostNetwork: true Answer: A Explanation: A toleration for NoExecute with tolerationSeconds permits the Pod to stay on the node for the specified time despite the taint. Question 53. Which of the following is NOT a valid QoS class in Kubernetes? A) Guaranteed B) Burstable C) BestEffort D) Premium Answer: D Explanation: Kubernetes defines three QoS classes: Guaranteed, Burstable, and BestEffort. “Premium” does not exist. Question 54. When using kubectl exec to troubleshoot a container, which flag forces a pseudo‑tty allocation? A) - i B) - t C) - c
D) - p Answer: B Explanation: The -t flag allocates a TTY, useful for interactive debugging sessions. Question 55. A Deployment uses the RollingUpdate strategy with maxSurge: 25% and maxUnavailable: 0. How many extra Pods can be created during an update if the original replica count is 8? A) 0 B) 1 C) 2 D) 3 Answer: B Explanation: 25% of 8 is 2, but maxSurge is rounded down to the nearest whole number, yielding 2 extra Pods; however, the scheduler caps at 2, so the answer is 2. (Correction: Actually Kubernetes rounds up for maxSurge; 25% of 8 = 2, so 2 extra Pods. The correct answer is C – 2.) Question 56. Which label is automatically added to Pods created by a Deployment? A) app.kubernetes.io/name B) pod-template-hash C) controller-revision-hash D) deployment.kubernetes.io/revision Answer: B Explanation: pod-template-hash is added to distinguish ReplicaSet Pods belonging to a specific Deployment revision. Question 57. In a multi‑cluster setup, which component is used to federate resources across clusters?