Q.21 Explain the concept of a Kubernetes ReplicaSet.

A ReplicaSet is a Kubernetes controller that’s primary job is to make sure a specified number of pod replicas (identical copies) are always running.

If pods exit/fail, the ReplicaSet creates new ones. If too many pods exist, it terminates extra ones.

Use Cases:

  • Ensuring High Availability: Keeps your application running even with node failures or pod crashes.
  • Scaling: Easily increase or decrease the number of replicas to handle varying workloads.

Example:

Q.22 How do you perform rolling updates in Kubernetes?

  • Rolling updates are a deployment strategy to update application pods with zero downtime.
  • Pods are updated incrementally: a few new version pods are launched, then a few old ones are terminated, in a controlled and gradual manner.

Use Cases:

  • Deploying New Code: Roll out new code versions without service interruption.
  • Configuration Changes: Apply configuration updates safely.

Example (using kubectl):

kubectl set image deployment/myapp-deployment myapp-container=myapp-image:v2

Q.23 What is a Kubernetes ingress, and how does it work?

  • An Ingress is a Kubernetes resource that manages external access (HTTP/HTTPS) to services inside a cluster.
  • It works by defining routing rules: incoming traffic is matched against these rules and then sent to the correct service within the cluster.
  • An Ingress Controller (e.g., NGINX, Traefik) is needed to interpret Ingress rules and route the traffic

Use Cases:

  • Exposing Multiple Services: Provide a single entry point for multiple services running in your cluster.
  • Load Balancing: Distribute traffic among different pods of a service.
  • TLS Termination: Handle secure HTTPS connections at the Ingress level.

Q.24 Describe the role of a Kubernetes scheduler.

  • The Kubernetes scheduler is a key component that decides which available node a new pod should run on.
  • It uses factors like:
    • Resource Requests: Pods requiring certain amounts of CPU and memory.
    • Node Capacity: The resources a node has available.
    • Policies: Rules controlling which pods can run on specific nodes.

Use Cases:

  • Optimal Placement: Ensures pods are distributed efficiently across the cluster, improving resource utilization.

Q.25 How do you troubleshoot a pod that is not running as expected?

Basic Checks:

  • kubectl get pods : Check pod’s status (Running, CrashLoopBackOff, etc.)
  • kubectl describe pod <pod-name> : Detailed status, events, recent errors.

Pod Logs:

  • kubectl logs <pod-name> : View application logs, potentially revealing errors.

Network and Resource Issues:

  • kubectl get nodes : Verify nodes are healthy and have capacity
  • Check for relevant pod events to pinpoint root causes.

Part 1- Kubernetes Interview Q & A (Q1-Q5)

Part 2- Kubernetes Interview Q & A (Q6-Q10)

Part 3 – Kubernetes Interview Questions & Answers (Q.11 to Q.15)

Part 4 – Kubernetes Interview Questions & Answers (Q.16 to Q.20)

Hope you find this post helpful.

Telegram: https://t.me/LearnDevOpsForFree

Twitter: https://twitter.com/techyoutbe

Youtube: https://www.youtube.com/@T3Ptech

Leave a Reply

Your email address will not be published. Required fields are marked *

DevOps Lifecycle Simplified Cybersecurity Lifecycle Top 10 Technical Roles for 2023 7 Tips to become Data Scientist