title | datePublished | cuid | slug | cover | tags |
---|---|---|---|---|---|
Day 37 Kubernetes Important Interview Questions |
Mon Nov 11 2024 11:15:48 GMT+0000 (Coordinated Universal Time) |
cm3cxghuu001009jt0kjvgizn |
day-37-kubernetes-important-interview-questions |
devops, k8s, 90daysofdevops, trainwithshubham, kubernetes-interview-questions, tws |
Are you preparing for a Kubernetes interview or just looking to deepen your understanding? This guide covers some essential Kubernetes questions you may encounter. Let’s dive into the key concepts!
-
Kubernetes, often referred to as K8s, is an open-source platform for automating the deployment, scaling, and management of containerized applications.
-
It’s crucial because it simplifies operational tasks for distributed systems, improves scalability, and enhances app availability.
-
Docker Swarm: Native clustering tool for Docker, simpler but with fewer features.
-
Kubernetes: More complex, robust, and feature-rich, with advanced options for scaling, auto-recovery, and load balancing.
-
Kubernetes uses a flat network model, where each pod has a unique IP address, allowing pods to communicate freely within a cluster.
-
Network plugins, like Calico or Flannel, enhance network functionality based on the cluster's needs.
-
Kubernetes automatically scales applications up or down based on metrics like CPU and memory usage.
-
This is achieved through Horizontal Pod Autoscaling (HPA) and Vertical Pod Autoscaling (VPA).
-
Deployment: Manages ReplicaSets, supports rolling updates, rollbacks, and maintains a desired state.
-
ReplicaSet: Ensures a specific number of pod replicas are running but lacks update and rollback capabilities.
-
Rolling updates in Kubernetes allow you to update your application gradually, without downtime.
-
Kubernetes replaces old versions of pods with new versions incrementally to ensure continuous availability.
-
Kubernetes uses Network Policies to control the communication between pods.
-
Access control is managed by RBAC (Role-Based Access Control), which restricts user actions within the cluster.
-
Deploy multiple replicas across multiple nodes to ensure redundancy.
-
Use Deployments and ReplicaSets to manage pods, and configure Load Balancers to distribute traffic.
-
Namespace: Logical partitioning in a Kubernetes cluster, enabling isolated environments.
-
By default, if no namespace is specified, the pod takes the
default
namespace.
-
Ingress exposes HTTP and HTTPS routes to services within a cluster.
-
It provides a single entry point to route external traffic to the right services, often with load balancing and SSL termination.
-
ClusterIP: Exposes the service within the cluster only.
-
NodePort: Exposes the service on each node’s IP at a static port.
-
LoadBalancer: Exposes the service externally with a load balancer.
-
ExternalName: Maps the service to an external DNS name.
-
Kubernetes automatically monitors and replaces failed containers, ensuring application health.
-
Examples include restarting crashed pods, rescheduling pods on healthy nodes, and replacing unresponsive nodes.
-
Kubernetes supports dynamic and persistent storage management.
-
Persistent Volumes (PV) and Persistent Volume Claims (PVC) are used for long-term storage across containers and sessions.
- The NodePort service exposes a pod on a static port on each node, allowing external access to the application using the node’s IP address and NodePort.
-
Single-Node Cluster: All components (control plane and worker nodes) run on one machine, suitable for testing.
-
Multinode Cluster: Multiple nodes for workload distribution, enhancing reliability and scalability.
-
kubectl create: Creates resources but will fail if they already exist.
-
kubectl apply: Creates or updates resources based on the specified configuration, making it ideal for applying changes.
Understanding these key Kubernetes concepts will give you a solid foundation in interviews and practical applications. Kubernetes is powerful, and mastering it can be highly beneficial for your career in DevOps or cloud-native environments. Good luck!