Kubernetes interview question and answers for ADVANCED LEVEL
Preethi Dovala
Vice President at JPMorgan Chase & Co. | Certified Kubernetes Application Developer(CKAD) | HashiCorp Certified Terraform Associate |Freelance Devops Instructor| AWS Certified Solutions Architect
1. Q: What are StatefulSets in Kubernetes, and when would you use them? ? ?A: StatefulSets are a Kubernetes controller used to manage stateful applications. They provide guarantees about the ordering and uniqueness of pods, making them suitable for applications that require stable network identities or persistent storage. StatefulSets are often used for databases, such as MySQL or PostgreSQL, where each pod has a unique identity and persistent storage attached.
?
2. Q: How does Kubernetes handle rolling updates? Explain the update strategy and any available options. ? ?A: Kubernetes handles rolling updates by gradually replacing the existing pods with the new version while ensuring the availability of the application. The default update strategy is called "RollingUpdate," where Kubernetes replaces pods incrementally, verifying the health of each new pod before proceeding to the next. This strategy ensures that the application remains available during the update process. There are additional options available, such as setting a maximum surge or maximum unavailable pods to control the update behavior further.
?
3. Q: What are Kubernetes Operators, and how do they extend the functionality of Kubernetes? ? ?A: Kubernetes Operators are a way to package, deploy, and manage applications using Kubernetes primitives. They extend the functionality of Kubernetes by encapsulating complex, application-specific operational knowledge. Operators automate application-specific tasks, such as managing backups, scaling, upgrades, and failure recovery. They leverage the Kubernetes API to provide a more declarative and scalable way of managing applications.
?
领英推荐
4. Q: How does Kubernetes perform service discovery and load balancing for pods within a cluster? ? ?A: Kubernetes uses a combination of DNS-based service discovery and a built-in load balancer called kube-proxy. Each Service within Kubernetes is assigned a unique DNS name, which can be resolved to the cluster IP. The kube-proxy component then load balances traffic across the pods associated with the Service, distributing requests evenly.
?
5. Q: Explain the concept of a PodDisruptionBudget (PDB) in Kubernetes and its significance. ? ?A: A PodDisruptionBudget (PDB) is a resource in Kubernetes used to limit the number of pods that can be simultaneously unavailable during disruptive events, such as node maintenance or pod evictions. PDBs ensure that a certain number of pods are always available for the application, enforcing high availability guarantees. PDBs help prevent unwanted downtime by allowing controlled disruptions and avoiding scenarios where critical applications are left with insufficient replicas.
6. Q: What are custom resource definitions (CRDs) in Kubernetes, and how do they enable the creation of custom resources? ? ?A: Custom Resource Definitions (CRDs) allow users to define their custom resources and extend the Kubernetes API. CRDs enable the creation of custom resources and controllers that can manage them. With CRDs, users can introduce new object types and declaratively manage them through the Kubernetes API server. This extensibility allows Kubernetes to be adapted to various use cases and domains beyond the core set of resources.
?
7. Q: Explain the concept of resource quotas in Kubernetes and how they help with cluster resource management. ? ?A: Resource quotas in Kubernetes are used to limit and track the resource consumption of objects within a namespace. They help ensure fair resource allocation, prevent resource starvation, and avoid any single application from consuming excessive resources. Resource quotas can be set for CPU, memory, storage, and other resource types. They play a crucial role in managing multi-tenant clusters and preventing runaway applications from impacting the overall cluster performance.