Why Kubernetes? Core Features and Microservice Orchestration Strategies

CK CK 3788 
Created at  
570 0 0

Kubernetes, often abbreviated as K8s, is an open-source system for automating deployment, scaling, and management of containerized applications. It groups containers that make up an application into logical units for easy management and discovery. Kubernetes provides a framework to run distributed systems resiliently, handling aspects like scaling, failover, deployment patterns, and more.

Why Kubernetes? Core Features and Microservice Orchestration Strategies

 

Origin and Creator

Kubernetes was originally designed by Google and released as open-source in 2014. It was derived from Google's internal system called Borg (later Omega), which managed large clusters of machines and containerized applications for many years. Google then partnered with the Cloud Native Computing Foundation (CNCF) to help maintain and develop Kubernetes, making it a community-driven project.

 

 

Key Features

Kubernetes offers a robust set of features to manage containerized workloads:

  • Automated Rollouts & Rollbacks: Automatically deploy new versions of applications or roll back to a previous version if something goes wrong.
  • Self-Healing: Automatically restarts failed containers, replaces and reschedules containers when nodes die, and kills containers that don't respond to user-defined health checks.
  • Service Discovery & Load Balancing: Kubernetes can expose a container using a DNS name or its own IP address. If traffic to a container is high, Kubernetes can load balance it and distribute the network traffic so that the deployment is stable.
  • Storage Orchestration: Automatically mounts a storage system of your choice, such as local storage, public cloud providers (GCP, AWS, Azure), or a network storage system (NFS, iSCSI, Ceph, Cinder, GlusterFS, etc.).
  • Secret & Configuration Management: Stores and manages sensitive information like passwords, OAuth tokens, and SSH keys. It can deploy and update configurations without rebuilding your container images and without exposing secrets in your stack configuration.
  • Automatic Bin Packing: Automatically places containers on nodes based on their resource requirements (CPU, memory) and other constraints, while not sacrificing availability.
  • Batch Execution: Manages batch and CI workloads, replacing failed containers if desired.

Why Kubernetes? Core Features and Microservice Orchestration Strategies

Kubernetes automates the mechanics of a rollout based on declared deployment strategies, efficiently managing updates to reach the desired state, and can execute rollbacks when explicitly instructed. However, the decision-making logic to automatically trigger a rollback in response to application failures or degraded performance typically resides outside of core Kubernetes controllers, requiring human-defined configurations, monitoring systems, or external CI/CD pipelines to provide that intelligence.

 

 

Why Use Kubernetes?

Kubernetes addresses critical challenges faced when operating modern, distributed applications at scale:

  • Scalability: Easily scale applications up or down based on demand, either manually or automatically.
  • High Availability & Resilience: Ensures applications remain available even if individual containers or nodes fail, by automatically detecting and replacing failures.
  • Portability: Runs consistently across different environments—on-premises, public clouds (AWS, Azure, GCP), or hybrid setups—preventing vendor lock-in.
  • Efficiency: Optimizes resource utilization by intelligently scheduling containers across a cluster, leading to cost savings.
  • Simplified Operations: Automates many manual processes involved in deploying, managing, and scaling applications, freeing up operational teams.
  • Developer Agility: Provides a consistent environment for developers to deploy and test their applications, accelerating release cycles.

 

 

How to Use Kubernetes

Using Kubernetes primarily involves defining the desired state of your applications and infrastructure using declarative configuration files (typically YAML or JSON), and then applying these configurations to a Kubernetes cluster using the kubectl command-line tool.

Why Kubernetes? Core Features and Microservice Orchestration Strategies

  1. Define Resources: Create YAML files that describe your applications (e.g., Deployments for pods, Services for network access, Ingress for external routing, Persistent Volumes for storage).
  2. Deploy to Cluster: Use kubectl apply -f your-resource.yaml to send these definitions to the Kubernetes API server.
  3. Monitor & Manage: Use kubectl get, kubectl describe, kubectl logs, and kubectl exec to inspect, debug, and interact with your running applications.
  4. Scale & Update: Use kubectl scale to change the number of replicas, or update your YAML files and re-apply them for rolling updates.

The most fundamental and core flow in Kubernetes is to define and apply your desired state (YAML) and then get the current state, a method Kubernetes calls Declarative Management. However, when operating services stably in the real world, relying solely on apply and get proves insufficient, and the true power of Kubernetes is unleashed through its additional extended engineering features, which can be broadly categorized into five core areas.

 

 

Simple Usage Example 1. Deploying a Nginx Web Server

This example deploys a simple Nginx web server and exposes it.

nginx-deployment.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  selector:
    matchLabels:
      app: nginx
  replicas: 2 # Run two instances of Nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:latest # Use the latest Nginx image
        ports:
        - containerPort: 80

 

nginx-service.yaml:

apiVersion: v1
kind: Service
metadata:
  name: nginx-service
spec:
  selector:
    app: nginx # Selects pods with the label 'app: nginx'
  ports:
    - protocol: TCP
      port: 80 # The port the service exposes
      targetPort: 80 # The port the container listens on
  type: LoadBalancer # Exposes the service externally using a cloud provider's load balancer

 

Why Kubernetes? Core Features and Microservice Orchestration Strategies

Steps:

  1. Apply the deployment: kubectl apply -f nginx-deployment.yaml
  2. Apply the service: kubectl apply -f nginx-service.yaml
  3. Check the deployment status: kubectl get deployments
  4. Check the service to get its external IP: kubectl get services
    (You might need to wait a moment for the EXTERNAL-IP to be assigned by your cloud provider.)

 

Scaling an Application


Once the Nginx deployment is running, you can easily scale it.

To scale the Nginx deployment to 5 replicas:

kubectl scale deployment/nginx-deployment --replicas=5

To scale down to 1 replica:

kubectl scale deployment/nginx-deployment --replicas=1

 

 

Kubernetes is said to have a core feature that allows the system to survive and adjust on its own without requiring constant user intervention. How does it know if a container is dead or alive? Don't you need to set some conditions beforehand?

Kubernetes determines if a container is alive or dead through configurable health checks called probes. Liveness probes detect when a container has entered a failed state and should be restarted, ensuring the system can self-heal. Readiness probes indicate whether a container is ready to serve traffic, allowing Kubernetes to direct requests only to healthy instances. Additionally, startup probes can be used for applications that take a long time to initialize. These conditions, including the type of check, such as HTTP GET, TCP socket check, or executing a command, along with thresholds and intervals, must indeed be predefined by the user within the pod specification for each container.

Why Kubernetes? Core Features and Microservice Orchestration Strategies

 

 

Simple Usage Example 2. Shopping Mall Application Example

Consider a large online shopping mall with millions of users and a wide range of products. Such an application is typically built using a microservices architecture, where each business capability (e.g., user authentication, product catalog, order processing, payment, recommendation engine) is a separate, independently deployable service. Kubernetes is an ideal platform for managing this complexity:

Why Kubernetes? Core Features and Microservice Orchestration Strategies

  • Microservice Deployment: Each service (e.g., user-service, product-catalog, order-service, payment-gateway, recommendation-engine, frontend-web) is deployed as a separate Kubernetes Deployment. This allows independent development, testing, and deployment for each service.
    • Dynamic Scaling:
      • During seasonal sales (e.g., Black Friday), the product-catalog and order-service might experience massive spikes in traffic. Kubernetes can be configured with Horizontal Pod Autoscalers (HPAs) to automatically increase the number of pods for these services based on CPU utilization or custom metrics (e.g., requests per second).
      • The payment-gateway might need to scale up during peak checkout times, while the recommendation-engine might scale down during off-peak hours to save resources.
  • High Availability and Resilience:
    • If a server hosting several order-service pods crashes, Kubernetes automatically detects the failure and reschedules those pods onto healthy nodes, ensuring continuous order processing.
    • Readiness probes ensure that only healthy instances of services receive traffic, and liveness probes automatically restart containers that become unresponsive.
  • Service Discovery and Load Balancing:
    • The frontend-web service needs to communicate with the product-catalog service. Kubernetes' internal DNS system allows services to discover each other using simple names (e.g., product-catalog.default.svc.cluster.local).
    • A Kubernetes Service exposes each microservice, automatically load-balancing incoming requests across all healthy pods of that service. An Ingress controller manages external access to the frontend-web and API gateway services.
  • Rolling Updates with Zero Downtime:
    • When the user-service needs an update (e.g., new login feature), Kubernetes performs a rolling update. It gradually replaces old pods with new ones, ensuring that there are always active user-service instances available to handle user authentication, preventing any downtime during the update. If the new version has issues, it can automatically roll back.
  • Configuration and Secrets Management:
    • Database connection strings, API keys for external payment providers, and various feature flags for different services are stored securely as Kubernetes Secrets and ConfigMaps, injected into the respective service pods at runtime.
  • Persistent Storage:
    • For stateful services like a database (e.g., a customer database or product inventory database), Kubernetes can provision Persistent Volumes from underlying storage systems (cloud provider disks, NFS, etc.) and attach them to the database pods, ensuring data persistence even if the pods are restarted or moved.

By leveraging Kubernetes, the shopping mall application can efficiently manage its complex microservices, ensuring high availability, scalability, and faster feature delivery, which are critical for a competitive e-commerce business.

If you were to write a large-scale microservice architecture, such as for a shopping mall, all into a single file, it would become a huge and complex YAML file exceeding thousands of lines.

 

In my current work, to address this, we manage files by separating them or using automation tools. Here are three commonly used architecture management methods:

 

1. Service-specific File Separation (Most Basic)

Instead of putting all configurations into a single file, we manage them by splitting folders and files on a service-by-service basis.

  • frontend/deployment.yaml, frontend/service.yaml
  • order/deployment.yaml, order/service.yaml, order/hpa.yaml

When deploying, you can apply them all at once by issuing a command at the folder level, like kubectl apply -f order/.

 

2. Helm (The Package Manager for Kubernetes)

Just like downloading an app from an app store, we most frequently use a tool called Helm, which packages Kubernetes configurations.
Repetitive and complex YAML structures are created as a template just once.
Each service, such as user-service and order-service, is reused by only replacing core values like the name, image address, and port number (typically defined in a values.yaml file). This significantly reduces the amount of code that needs to be managed.

 

3. GitOps and CI/CD Tools (e.g., ArgoCD)

It is risky for humans to directly view large YAML files and type commands (e.g., kubectl apply).
If you upload the separated YAML files to a Git repository, tools like ArgoCD detect changes in Git and automatically apply them to the Kubernetes cluster.

Tags Application Deployment ArgoCD CI/CD Kubernetes Container Orchestration Deployment Automation Deployment Strategy DevOps Automation GitOps Helm K8s Kubernetes Kubernetes Management Kubernetes Rollback Kubernetes Rollout Package Manager Release Management YAML 쿠버네티스 쿠베 Facebook X
Comments 0
Similar posts
  1. Kubernetes, aka K8s, is an open-source container orchestration platform
    539
  2. Uvicorn, Gunicorn: Proving Your Production Prowess
    395
  3. The Ultimate Data Engineering Roadmap
    1,069
  4. Technical Hierarchy of AI Agents
    808
  5. Messaging Platform with Limited TPS based on the vendor
    194
  1. gRPC - Open-source Universal RPC Framework developed by Google
    766
  2. Exploring the Depths of Data Transfer: sendfile vs. kTLS
    1,317
  3. How Netflix Ensures Smooth Streaming with Open Connect CDN
    2,127
  4. Public DNS (Domain Name Service) based on IPv4, IPv6 widely used
    1,240
  5. All Engineering Software Development How can you prioritize software design trade-offs when developing a new product?
    1,339
  6. MR(Mixed Reality) Game Programming based on Unity 3D
    1,353
  7. Temporal Programming Model - Robust, Long-Running, Fault-Tolerant Applications as WorkFlows
    349
  8. Cadence Programming Model - A Distributed, Fault-Tolerant, Stateful Workflow Orchestration Framework
    286
  9. Multi-AZ Kafka Architecture
    141
  10. Large-Scale Concurrency Control: Solving the DB Bottleneck from a Flood of “Likes”
    269
  11. Hybrid Methods for Recommendation Service
    213
  12. Model-Based CF: Matrix Factorization for Recommendation Service
    177
  13. Memory-Based Collaborative Filtering for Recommendation Service
    186
  14. Content-Based Filtering for Recommendation Service (aka User-based Model)
    187
  15. Stateful Databases: A Deep Dive with Cassandra & TiDB
    186
  16. Quiz : Twice counter
    700
  17. Kubernetes, aka K8s, is an open-source container orchestration platform
    539
  18. Architecting for Resilience: AWS High Availability Components Including API Gateway
    133
  19. Is AWS API Gateway Disaster-Proof? DR, Benefits, and Multi-AZ Architecture Explained
    140
  20. FNC(Photo/Video File Name Changer) v1.1 Release - Date Time Bug Fix & Retry Function Added
    703
  21. Smart TV Cycling Apps – TV for Fitness
    807
  22. The public could reduce server cost, and enhance performance for global service distribution
    10,740
  23. Cloud gaming coming to Samsung Smart TVs
    556
  24. Kids App – Kids Learn While Parents Control on Samsung Smart TV
    761
  25. Fitness Hub presents your personal trainer, Fitness VOD on Samsung Smart TV
    520
  26. Word counting source program based on MapReduce framework
    692
  27. The leaders who created Smart TV
    811
  28. FNC(Photo/Video File Name Changer) v1.02 release - The file created date time information is available for those cameras providing incorrect EXIF data
    974
  29. Samsung Apps hits 5 million Smart TV app downloads
    647
  30. Your Video – VoD content recommendation service on Samsung Smart TV
    555
Recently updated
  1. Why 100% SEO Guarantees Better User Engagement and How to Achieve It in Your Service
    27
  2. Why SPF and DKIM Are Essential for Linux Email Servers?
    24
  3. How do I create animated background for Google Meet?
    19,732
  4. MaxMind GeoLite2 vs. DB-IP Lite vs. ip-api.com: Choosing the Right Free IP Geolocation Solution
    217
  5. Meet Valkey: Why Redis Changed Its License, Why Valkey is Better, and How to Use It as a Drop-in Replacement
    86
  6. How Rogue Web Scrapers Are Stealing My Content and Destroying My Server
    153
  7. Array of arguments passed to script in PHP
    85
  8. Invalid Auction Storms in Ad Tech
    93
  9. Building MRC-Compliant Instrumentation in Ad Tech: Implementation Steps and Key Challenges
    198
  10. The Two Clocks of Ad Server Architecture
    63
  11. Frequency Cap Architecture Overview
    509
  12. Collecting Proof-of-Play from 100,000 Screens
    141
  13. Vector Search in Relational Databases (RDBs): Trends & Usage Environments
    280
  14. What is RedisVL?
    105
  15. Designing a Skill Registry Architecture: Minimize Token Usage and Maximize AI Performance
    224
  16. TPU & GPU Cluster Management Tools
    234
  17. The Concept of Scaffolding in AI Agents
    222
  18. Beyond Static Pipelines: Architecting LLM Multi-Agent Systems for Autonomous Workflow Orchestration
    576
  19. AI-DLC vs. AI-SDLC: Model-Centric vs. System-Centric AI Development
    253
  20. Fine-Tuning Open-Weight LLMs: Training, Licensing, and Deploying Custom Models with Ollama
    328
  21. Inside the Next-Generation Streaming Architecture: Ultra-Low Latency, SGAI, and AI Codecs
    197
  22. Machine Learning: Training vs. Ranking
    213
  23. The Continuous Learning Machine: Designing a Loop That Actually Turns
    217
  24. The Next-Gen Low-Latency Standards: LL-HLS & MoQ
    189
  25. Designing a Data Curation System Around a Vector Database
    215
  26. Extracting Context from Live Video: The Architecture Got Simpler When We Stopped Building Features
    229
  27. The New Ad Stack Behind Live Sports Streaming: Inside SGAI, EABN, and the Standards Race to Fix Live Monetization
    649
  28. Designing MLOps Architectures to Handle Seasonal Data Drift in EV Fleet Models
    185
  29. From 15 to 40+ FPS: Accelerating PyTorch Object Detection on Automotive ECUs
    207
  30. Understanding Data Lineage
    252