Kubernetes Cluster Upgrade Strategy: From Planning to Zero-Downtime Execution

Overview Kubernetes releases three minor versions per year, each with a support cycle of approximately 14 months. This means production clusters need to be upgraded roughly every 6-12 months. Cluster upgrades are one of the most sensitive operations in K8s operations — you must keep pace with the community for security patches and new features while ensuring zero downtime and zero failures during the upgrade process. This article covers the complete methodology of Kubernetes cluster upgrades, from version strategy formulation, pre-upgrade preparation, upgrade execution, blue-green/canary strategies, rollback mechanisms, to production-grade best practices....

January 3, 2025 · 19 mins · 3962 words · XuBaojin

Chaos Engineering: Proactively Discovering System Weaknesses

Overview The traditional approach to reliability is “try not to have failures” — add monitoring, add alerts, add redundancy. But this passive defense has a fundamental flaw: you don’t know how the system actually behaves during a failure until one actually occurs. Chaos engineering takes the opposite approach: proactively and controllably inject failures to discover system weaknesses before they become incidents. It’s not about causing destruction — it’s a scientific experimental method: form a hypothesis (“the system should be able to withstand a node failure”), design an experiment (kill a node), verify the hypothesis (is the service still working?...

December 17, 2024 · 16 mins · 3405 words · XuBaojin

Kubernetes Cost Optimization in Practice: From Resource Governance to FinOps

Overview Kubernetes has become the standard runtime platform for cloud-native applications, but its elasticity and flexibility also bring significant cost management challenges. According to the Flexera 2024 State of the Cloud report, enterprises waste an average of 32% of their cloud spending, and resource waste in Kubernetes clusters is particularly pronounced — an ungoverned K8s cluster often has resource utilization below 30%. Kubernetes cost optimization is not a one-time configuration adjustment, but a systematic engineering effort spanning resource governance, autoscaling, instance type selection, and FinOps culture building....

November 22, 2024 · 23 mins · 4737 words · XuBaojin

Kubernetes Multi-Cluster Management in Practice

Overview When your business scale grows beyond what a single cluster can handle, multi-cluster becomes an inevitable choice. Reasons include: single cluster node limits (5000 nodes), multi-region deployment, hybrid cloud strategy, fault isolation, and compliance requirements. But multi-cluster management complexity grows exponentially—how to deploy applications across clusters, discover services cross-cluster, synchronize configurations, and handle failover. This article systematically covers multi-cluster architecture patterns, mainstream management tool comparisons, and practical solutions for cross-cluster service discovery, CI/CD, and disaster recovery failover....

November 20, 2024 · 10 mins · 2124 words · XuBaojin

Kubernetes Disaster Recovery: From etcd Backup to Velero

Overview “Hope for the best, prepare for the worst.” In Kubernetes production environments, disaster recovery is the last line of defense. Whether it’s etcd corruption, accidental deletion, node failure, or even entire cluster loss, having a solid backup and recovery strategy is critical. This article systematically covers K8s disaster recovery—from etcd backup and restore, Velero full-cluster backup, PV data backup, to cross-cluster recovery and disaster recovery architecture design. Based on Kubernetes v1....

October 21, 2024 · 14 mins · 2846 words · XuBaojin

Kubernetes Autoscaling: HPA/VPA/CA Deep Dive

Overview Autoscaling is one of Kubernetes’ most attractive capabilities—scale up when traffic arrives, scale down when it leaves, ensuring service quality while controlling costs. But “automatic” doesn’t mean “mindless.” Poorly configured autoscaling can cause: delayed scaling leading to service degradation, aggressive scale-down disrupting long connections, and flapping scaling wasting resources. K8s autoscaling consists of three layers plus an event-driven extension: Layer Component Scaling Dimension Trigger Pod horizontal HPA Pod replica count CPU/memory/custom metrics Pod vertical VPA Pod resource quotas CPU/memory historical usage Node Cluster Autoscaler Node count Pending Pods Event-driven KEDA Pod replica count Event sources (Kafka/Redis/…) Based on Kubernetes v1....

August 19, 2024 · 13 mins · 2692 words · XuBaojin

Kubernetes Operator Development Guide

Overview A Kubernetes Operator is a pattern that packages the operational knowledge of a specific application (like deployment, scaling, backup, recovery) into automated controller software. Instead of manually editing YAML or running kubectl commands, Operators monitor custom resources and automatically reconcile the cluster toward the desired state. This guide provides a deep dive into Operator development—from CRD design principles and Controller reconciliation loops to operator-sdk/kubebuilder hands-on development, testing, and release....

July 23, 2024 · 17 mins · 3507 words · XuBaojin

Capacity Planning and Elastic Scaling in Practice

Overview Capacity planning is a core SRE responsibility. The Google SRE Book treats capacity planning as “proactive work,” emphasizing data-driven forecasting over experience-based guessing. A team without capacity planning either gets crushed by traffic during peaks or wastes significant resource costs during valleys. This article systematically covers capacity planning engineering practices across four dimensions: metric collection, data modeling, Kubernetes elastic scaling configuration, and pitfall avoidance. For a systematic methodology on capacity planning, see Google SRE Book - Capacity Planning and its discussion of capacity planning and cascading failures....

June 27, 2024 · 10 mins · 1970 words · XuBaojin

Kubernetes Pod Troubleshooting Cheatsheet

Troubleshooting Path kubectl get pods → check status kubectl describe pod → check Events kubectl logs → check logs Common Pod States State Meaning Common Cause Pending Not scheduled Insufficient resources, scheduling constraints CrashLoopBackOff Crash loop App error, config issue ImagePullBackOff Image pull failed Image not found, auth failure OOMKilled Out of memory Memory limit too low CrashLoopBackOff Most common issue. Troubleshooting steps: # Check previous crash logs kubectl logs <pod> --previous # Check exit code kubectl get pod <pod> -o jsonpath='{....

May 8, 2024 · 2 mins · 280 words · XuBaojin

Kubernetes RBAC and Security Contexts

Overview The default Kubernetes security posture can be summed up in one word: open. The default ServiceAccount has broad API access (depending on version and PSP configuration), Pods run as root, containers can mount the host filesystem, and the network is fully open. This “default open” design lowers the barrier to entry but creates significant security risks in production. This article covers RBAC permission models, ServiceAccount management, Pod Security Standards, SecurityContext, NetworkPolicies, and audit logging—systematically explaining K8s security hardening practices....

May 2, 2024 · 12 mins · 2449 words · XuBaojin