GitOps Workflow: ArgoCD in Practice

GitOps Core Principles GitOps is a modern continuous delivery methodology introduced by Weaveworks in 2017. It uses Git as the Single Source of Truth for infrastructure and application configuration, achieving continuous deployment through declarative practices. According to the ArgoCD documentation, GitOps follows four core principles: 1. Declarative System Infrastructure and application configurations are stored in Git as declarative descriptions (YAML/Helm/Kustomize): # Example Git repository structure infra-repo/ ├── apps/ │ ├── frontend/ │ │ ├── deployment....

July 22, 2024 · 8 mins · 1690 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

Container Runtime: containerd and CRI Deep Dive

Overview Kubernetes v1.24 officially removed dockershim, meaning Docker Engine is no longer used as the K8s container runtime. Instead, CRI-compliant (Container Runtime Interface) runtimes are used, with containerd being the de facto standard choice. Many ops teams perceive containerd as merely a “Docker replacement,” but its architecture, image management, and CLI tools differ significantly from Docker. This article provides a deep dive into the CRI specification, containerd architecture, daily operations, and migration from Docker....

June 14, 2024 · 12 mins · 2385 words · XuBaojin

Runbook Writing Guide: Making Operational Knowledge Reproducible

Overview Woken up by an alert at 3 AM, facing an unfamiliar service — how fast can you recover? If you need to scroll through chat logs, ask colleagues, and dig through code to figure out what to do, your team is missing one thing — a Runbook. A Runbook is the most fundamental yet most easily overlooked engineering practice in the SRE framework. It bridges the gap between “alert” and “action” — an alert tells you “something is wrong,” and a Runbook tells you “what to do....

June 11, 2024 · 18 mins · 3665 words · XuBaojin

Prometheus Service Discovery Mechanisms Explained

Overview In the Prometheus monitoring system, Service Discovery (SD) is the bridge connecting “monitoring targets” to the “scrape engine.” When your infrastructure scales from a few VMs to hundreds of Kubernetes Pods, cross-AZ cloud instances, and Consul-registered nodes, manually maintaining static_configs becomes a nightmare — every scale-up, scale-down, or migration requires config changes and Prometheus restarts, and alerts may misfire due to unreachable targets. Prometheus natively supports over a dozen service discovery mechanisms that can automatically detect target changes without restarts....

June 6, 2024 · 13 mins · 2600 words · XuBaojin

Python Log Analysis Scripts in Practice

Overview Logs are the most authentic record left by a running system. When something goes wrong in production, logs are the first crime scene; when you need insight into system behavior, logs are the richest data source. But log analysis isn’t just about grep-ing a few keywords — facing tens of GB of logs daily, you need efficient parsing, flexible aggregation, intelligent anomaly detection, and clear visualization. This article builds a complete log analysis toolkit from scratch using Python....

June 5, 2024 · 18 mins · 3813 words · XuBaojin

Linux Process Scheduler: CFS Principles and Tuning

Overview The process scheduler is a core component of the operating system kernel — it determines which process runs on which CPU and for how long. Linux has used CFS (Completely Fair Scheduler) as its default scheduler since 2.6.23, and after years of evolution, introduced EEVDF (Earliest Eligible Virtual Deadline First) to replace CFS in the 6.6 kernel. This article provides an in-depth analysis of CFS principles, nice/cgroup CPU control, real-time scheduling, CPU affinity, and other core topics, with production tuning experience....

May 29, 2024 · 10 mins · 2121 words · XuBaojin

Alert Automation and Remediation: From Alert Storms to Self-Healing Systems

Overview 3 AM. Your phone buzzes. You get out of bed, open your laptop, SSH in, and find a service with CPU spiking. Kill the process, restart the service, 12 minutes done — but you’re wide awake now. 4:30 AM, another alert: disk usage exceeds 85%. Get up again, du -sh to locate, delete old logs, 15 minutes. This is the daily reality for countless operations engineers. Monitoring is set up, alerts are configured, scripts are written — but the final step still relies on humans....

May 28, 2024 · 31 mins · 6470 words · XuBaojin

Incident Response Framework: SEV Classification and Escalation Flow

Overview Incidents are inevitable, but the quality of your incident response determines the impact scope and duration. A mature incident response framework can bring order to chaos — ensuring the right people do the right things, information flows where it needs to go, and recovery happens as fast as possible. The reality many teams face during incidents: alert bombardment, chat channel flooding, unclear ownership, duplicate investigations, inconsistent external messaging, and inability to explain what happened after recovery....

May 23, 2024 · 20 mins · 4176 words · XuBaojin

Distributed Tracing: Jaeger Implementation in Practice

Why Distributed Tracing In a microservices architecture, a single user request often traverses multiple services. When an endpoint’s latency spikes from 200ms to 2s, logs are scattered across N machines, making it difficult to pinpoint the bottleneck — is it slow gateway forwarding, a slow downstream DB query, or queuing in an inter-service call? Distributed tracing solves exactly this problem: it generates a globally unique Trace ID for each request, propagates it across services, and ultimately renders a complete call chain tree in the UI, making the duration of each segment visible at a glance....

May 16, 2024 · 9 mins · 1742 words · XuBaojin