0% found this document useful (0 votes)
16 views2 pages

Kubernetes Essentials for DevOps

Kubernetes is an open-source container orchestration platform that automates the deployment, scaling, and management of containerized applications. Key concepts include Pods, ReplicaSets, Deployments, and Services, while best practices involve defining resource limits and implementing health checks. Real-world applications, such as a fintech company using Kubernetes on AWS EKS, demonstrate its effectiveness in managing microservices and ensuring high availability.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views2 pages

Kubernetes Essentials for DevOps

Kubernetes is an open-source container orchestration platform that automates the deployment, scaling, and management of containerized applications. Key concepts include Pods, ReplicaSets, Deployments, and Services, while best practices involve defining resource limits and implementing health checks. Real-world applications, such as a fintech company using Kubernetes on AWS EKS, demonstrate its effectiveness in managing microservices and ensuring high availability.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

DevOps Notes – Kubernetes

Prepared by Sathish Kumar

Introduction
Kubernetes, also known as K8s, is an open-source container orchestration platform developed by
Google. It automates deployment, scaling, and management of containerized applications. Kubernetes
helps DevOps engineers manage clusters of containers efficiently, ensuring scalability and high
availability.

Core Concepts
1 Pod: The smallest deployable unit that can contain one or more containers.
2 ReplicaSet: Ensures that a specified number of pod replicas are running at all times.
3 Deployment: Manages ReplicaSets and ensures smooth updates and rollbacks.
4 Service: Exposes a set of pods as a network service, providing stable networking and load
balancing.
5 Namespace: Logical partition of cluster resources for better management and isolation.
6 ConfigMap & Secret: Used to store configuration data and sensitive credentials separately from
code.

Common Commands
1 kubectl get pods – Lists all running pods.
2 kubectl describe pod – Shows detailed pod info.
3 kubectl logs – Displays logs from a pod.
4 kubectl exec -it -- /bin/bash – Opens shell inside a container.
5 kubectl apply -f [Link] – Deploys resources from a manifest file.
6 kubectl rollout undo deployment/ – Rolls back to the previous deployment.

Best Practices
1 Always define resource limits (CPU and memory) for containers.
2 Use namespaces to separate environments (dev, staging, prod).
3 Store configurations in ConfigMaps and secrets separately.
4 Implement readiness and liveness probes for health checks.
5 Use RBAC (Role-Based Access Control) for security.
6 Regularly update cluster versions and components.

Real-World Use Case


A fintech company deploys microservices using Kubernetes on AWS EKS. Each microservice is
packaged in Docker containers. Jenkins pipelines build and push images to ECR, and manifests are
applied using kubectl or ArgoCD. Autoscaling ensures traffic spikes are handled efficiently, while
Prometheus and Grafana monitor performance.

Interview Questions and Answers


Q1: What is the difference between Deployment and StatefulSet?
Deployments manage stateless applications, while StatefulSets manage stateful applications that
require persistent storage and stable network identities.

Q2: What is a CrashLoopBackOff error?


It occurs when a pod repeatedly crashes after starting. Causes include configuration errors, missing
environment variables, or failing startup scripts.

Q3: How do you check pod logs?


Use `kubectl logs ` to view container logs and diagnose issues.

Q4: What are liveness and readiness probes?


They are health checks that determine when a pod is ready to receive traffic or needs to be restarted.

Q5: How do you secure a Kubernetes cluster?


Enable RBAC, use network policies, restrict public access, and regularly rotate credentials and tokens.

Q6: How does Kubernetes handle scaling?


Horizontal Pod Autoscaler (HPA) automatically increases or decreases pod count based on CPU or
memory usage.

Q7: What is the purpose of Ingress?


Ingress manages HTTP/HTTPS access to services within a cluster, often integrated with load
balancers.

Q8: How do you manage secrets in Kubernetes?


Use Kubernetes Secrets, sealed secrets, or external secret managers like AWS Secrets Manager or
HashiCorp Vault.

Summary
Kubernetes simplifies the orchestration of containerized workloads and is a crucial skill for modern
DevOps engineers. It enables efficient scaling, deployment automation, and resource management.
Mastery of its concepts, commands, and troubleshooting techniques enhances stability and
performance across environments.

You might also like