Top 50 Kubernetes Interview Question and Answers

Top 50 Kubernetes Interview Question and Answers
  1. What is Kubernetes?
    Kubernetes is an open-source container orchestration platform designed to automate the deployment, scaling, and management of containerized applications.

  2. What is a Kubernetes Pod?
    A pod is the smallest deployable unit in Kubernetes, typically containing one or more containers with shared storage and network resources.

  3. What are the main components of Kubernetes architecture?

    • Master Node (API Server, Controller Manager, Scheduler, etcd)
    • Worker Nodes (Kubelet, Kube-Proxy, Container Runtime)
  4. What is etcd in Kubernetes?
    etcd is a distributed key-value store that stores the cluster state and configuration data, enabling Kubernetes to maintain cluster consistency.

  5. What is the role of a Kubelet?
    The Kubelet is an agent on each node that ensures containers are running as expected and manages pod operations.

  6. Explain the Kubernetes API Server.
    The API server is the frontend for the Kubernetes control plane, handling REST requests to manage and retrieve the state of resources.

  7. What is a Namespace in Kubernetes?
    A namespace is a virtual cluster within Kubernetes, used to divide cluster resources between multiple users or teams.

  8. How does Kubernetes handle networking?
    Kubernetes uses networking models such as CNI plugins (like Calico, Flannel) to provide a flat network for communication between pods.

  9. What is a Service in Kubernetes?
    A Service is an abstract way to expose an application running in a set of pods as a network service, providing stable access.

  10. What is a ReplicaSet?
    A ReplicaSet ensures a specified number of pod replicas are running at all times, aiding in load balancing and availability.

  11. What is a StatefulSet?
    StatefulSet manages stateful applications, where each pod has a unique identifier and stable, persistent storage.

  12. Explain DaemonSet in Kubernetes.
    A DaemonSet ensures that a copy of a pod runs on all or specific nodes, commonly used for logging and monitoring.

  13. What is a Persistent Volume (PV)?
    PV is a storage resource in a cluster, allowing pods to store data beyond their lifecycle.

  14. What is a Persistent Volume Claim (PVC)?
    PVC is a request for storage by a user, which binds to a PV to meet the claim’s specified storage needs.

  15. How does Horizontal Pod Autoscaling work?
    Horizontal Pod Autoscaler adjusts the number of pod replicas based on CPU/memory metrics, improving resource utilization.

  16. What is Ingress in Kubernetes?
    Ingress is an API object that manages external access to services, typically HTTP/HTTPS, providing routing rules.

  17. Explain ConfigMap in Kubernetes.
    ConfigMap allows external configuration of application settings without rebuilding images.

  18. What is Secret in Kubernetes?
    A Secret is an object that stores sensitive information, like passwords, in a secure and base64-encoded format.

  19. What are Labels in Kubernetes?
    Labels are key-value pairs attached to objects like pods, used for organizing and selecting subsets of objects.

  20. Explain Taints and Tolerations.
    Taints and tolerations work together to control which pods can run on specific nodes.

  21. What is Helm?
    Helm is a package manager for Kubernetes, used to manage, install, and update applications as charts.

  22. Explain Node Affinity.
    Node affinity allows scheduling constraints on which pods can run on specific nodes based on labels.

  23. What is a Custom Resource Definition (CRD)?
    CRD allows users to define custom resources that extend the Kubernetes API.

  24. What is the role of the Scheduler?
    The Scheduler assigns pods to nodes based on resource requirements, policies, and constraints.

  25. How does Kubernetes handle high availability?
    By replicating critical components, like etcd and the API server, across multiple nodes.

  26. What is Kubectl?
    kubectl is a command-line tool to interact with Kubernetes clusters for managing resources.

  27. What is Minikube?
    Minikube is a tool that enables running Kubernetes clusters locally on a single node.

  28. Explain RBAC in Kubernetes.
    Role-Based Access Control (RBAC) restricts access to Kubernetes resources based on roles and role bindings.

  29. What is the purpose of a ServiceAccount?
    A ServiceAccount provides an identity for pods to interact with the Kubernetes API securely.

  30. What is the difference between a Deployment and a StatefulSet?
    Deployment manages stateless applications, while StatefulSet manages stateful applications, ensuring pod identity and persistent storage.

  31. How to troubleshoot a pod in Kubernetes?
    Use kubectl logs, kubectl describe pod, and kubectl get events to diagnose issues.

  32. What is Pod Disruption Budget (PDB)?
    PDB specifies the minimum number of pods that must be up, preventing disruptions below a certain threshold.

  33. How does Kubernetes handle secrets?
    Secrets are stored in base64 format and can be mounted as volumes or environment variables.

  34. What is a Kubernetes Operator?
    Operators are applications that extend Kubernetes, encapsulating complex operational knowledge for managing resources.

  35. How does Kubernetes handle scaling?
    Kubernetes scales applications horizontally using the Horizontal Pod Autoscaler and node scaling via Cluster Autoscaler.

  36. What are Init Containers?
    Init containers run before application containers to perform setup tasks like configuration or dependency checks.

  37. Explain the role of Cluster Autoscaler.
    The Cluster Autoscaler adds or removes nodes based on the scheduling requirements of pending pods.

  38. How can you create a Kubernetes cluster?
    Use tools like kubeadm, kops, or cloud providers (EKS, GKE, AKS) to create a Kubernetes cluster.

  39. What is the function of Kube-Proxy?
    Kube-Proxy handles network rules on nodes, managing traffic routing for services within the cluster.

  40. How to restrict network communication in Kubernetes?
    Network Policies control communication between pods, allowing restrictions based on labels and namespaces.

  41. How do you secure a Kubernetes cluster?

    Implement RBAC, limit API access, use network policies, secure etcd, and regularly update components.

  42. What is a Sidecar Container?
    A sidecar container runs alongside the main container to assist with tasks like logging, monitoring, or proxying.

  43. What is a Headless Service?
    A Headless Service provides direct access to individual pod IPs without load balancing, enabling stateful applications.

  44. What is the purpose of Kubernetes Audit Logs?
    Audit logs record actions taken by users or other components in the Kubernetes API server.

  45. How does Kubernetes handle multi-tenancy?
    By using namespaces, RBAC, and network policies, Kubernetes isolates resources between tenants.

  46. Explain Blue-Green Deployment in Kubernetes.
    In Blue-Green Deployment, two environments run simultaneously, allowing one to be live while the other is updated.

  47. How does Kubernetes support canary deployments?
    By gradually shifting traffic to new versions using multiple services, Ingress, or tools like Istio.

  48. What is an Admission Controller in Kubernetes?
    Admission controllers are plugins that validate and modify requests before they reach the API server.

  49. How to back up etcd in Kubernetes?
    Use etcdctl commands to create backups and store them securely, essential for cluster recovery.

  50. What is K8s Federation?
    Kubernetes Federation manages multiple clusters, enabling workloads to be distributed across clusters for high availability and disaster recovery.


meet razorops team

LATEST POSTS