Running Kubernetes in Production: Lessons Learned

Introduction

Kubernetes has become the de facto standard for container orchestration. However, running it in production requires careful planning and operational maturity.

Cluster Architecture

Control Plane High Availability

  • Run 3+ control plane nodes across availability zones
  • Use managed Kubernetes (EKS, AKS, GKE) when possible
  • Separate etcd to dedicated nodes for large clusters

Node Pools

Node Pools:
โ”œโ”€โ”€ system-pool (m5.large)
โ”‚   โ””โ”€โ”€ Core system components
โ”œโ”€โ”€ general-pool (m5.xlarge)
โ”‚   โ””โ”€โ”€ Standard workloads
โ”œโ”€โ”€ memory-pool (r5.2xlarge)
โ”‚   โ””โ”€โ”€ Memory-intensive apps
โ””โ”€โ”€ gpu-pool (p3.2xlarge)
    โ””โ”€โ”€ ML workloads

Resource Management

Requests and Limits

Always set both requests and limits:

resources:
  requests:
    memory: "256Mi"
    cpu: "250m"
  limits:
    memory: "512Mi"
    cpu: "500m"

Pod Disruption Budgets

apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: api-pdb
spec:
  minAvailable: 2
  selector:
    matchLabels:
      app: api

Priority Classes

Ensure critical workloads survive resource pressure:

apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
  name: high-priority
value: 1000000
globalDefault: false

Networking

Network Policies

Implement zero-trust networking:

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: api-policy
spec:
  podSelector:
    matchLabels:
      app: api
  ingress:
  - from:
    - podSelector:
        matchLabels:
          app: frontend
    ports:
    - port: 8080

Observability

The Three Pillars

  • Metrics: Prometheus + Grafana
  • Logs: Fluent Bit โ†’ Elasticsearch/Loki
  • Traces: OpenTelemetry โ†’ Jaeger/Tempo

Essential Dashboards

  • Cluster resource utilization
  • Node health and capacity
  • Pod restart rates
  • API server latency
  • etcd performance

Security

Pod Security Standards

apiVersion: v1
kind: Namespace
metadata:
  name: production
  labels:
    pod-security.kubernetes.io/enforce: restricted

Image Security

  • Scan images for vulnerabilities (Trivy, Clair)
  • Sign images (Cosign, Notary)
  • Use admission controllers to enforce policies

Disaster Recovery

  • Regular etcd backups
  • GitOps for configuration recovery
  • Multi-region deployment strategy
  • Tested recovery procedures

Lessons Learned

  1. Start with managed Kubernetes
  2. Invest in observability from day one
  3. Automate everything with GitOps
  4. Practice failure scenarios regularly
  5. Keep clusters reasonably sized

Conclusion

Production Kubernetes requires significant operational investment. Build your platform team's expertise gradually and automate relentlessly.

๐Ÿ“šTechnical Insights & Industry Trends

Insights & Knowledge Hub

Explore in-depth articles on software development, digital transformation, and emerging technologies. Learn from real-world experience.

Browse by Topic

๐Ÿ…ฐ๏ธ
ArchitectureJan 2024

Why Angular SSR Beats React for SEO in 2024

A comprehensive comparison of server-side rendering implementations and their impact on search engine optimization, performance, and user experience.

๐Ÿ”Œ
ArchitectureDec 2023

Microservices: When to Use and When to Avoid

Understanding the trade-offs of microservices architecture and making the right choice for your organization's scale, complexity, and team structure.

๐Ÿ—๏ธ
System ArchitectureJan 2024

Essential Design Patterns for Enterprise Systems

Master the fundamental design patterns that every software architect should know for building scalable, maintainable enterprise applications.

๐Ÿ—๏ธ
System ArchitectureJan 2024

Domain-Driven Design: A Practical Guide

Learn how to apply Domain-Driven Design principles to create software that truly reflects business requirements and scales with organizational complexity.

๐Ÿ—๏ธ
System ArchitectureDec 2023

Event-Driven Architecture: Complete Implementation Guide

Build loosely coupled, scalable systems using event-driven architecture patterns with practical examples using Kafka, RabbitMQ, and Azure Service Bus.

๐Ÿ—๏ธ
System ArchitectureDec 2023

RESTful API Design: Best Practices and Patterns

Design APIs that developers love to use. Learn REST principles, versioning strategies, error handling, and documentation best practices.

Deep Dives into Key Areas

๐Ÿ—๏ธ

System Architecture

Design patterns and architectural decisions

12 Articles
โ˜๏ธ

Cloud Computing

AWS, Azure, and cloud-native development

8 Articles
โšก

Performance

Optimization and scalability techniques

6 Articles
๐Ÿค–

AI & Machine Learning

Practical AI applications in enterprise

5 Articles
๐Ÿ”’

Security

Best practices and compliance

7 Articles
๐Ÿ“ฑ

Modern Frontend

Angular, React, and UI/UX best practices

10 Articles

Have a Project in Mind?

Let's turn your ideas into reality. Schedule a free consultation to discuss how we can help transform your business.