Understanding Kubernetes Controller Manager

The Control Loop The Controller Manager is the “brain” of the control plane. It runs various controllers that watch the state of the cluster and make changes to move the actual state toward the desired state. Workflow: Watch: Observe current state via the API Server. Reconcile: Compare actual state (e.g., 2 Pods running) with desired state (e.g., 3 Pods requested). Action: Issue commands to the API Server to reach the target (e.g., create 1 Pod). Key Controllers Deployment Controller: Manages ReplicaSets and ensures the correct number of Pods are running. Node Controller: Monitors node health and handles evictions. Job/CronJob Controllers: Manage one-time or scheduled tasks. Cloud Controller Manager: Integrates with cloud provider APIs to manage storage, load balancers, and network routes. Kubelet and Runtimes Kubelet is the agent running on every node. It receives PodSpecs from the API Server and ensures they are running. ...

December 13, 2023 · 2 min

Understanding Kubernetes Scheduler

1. Overview The kube-scheduler is the matchmaker of Kubernetes. Its job is to find the best Node for every newly created Pod. It considers: Resource availability: CPU/Memory/Storage. Affinity and Anti-affinity: Do Pods want to be together or apart? Taints and Tolerations: Should a Node repel certain Pods? Priorities: Which Pod is more important? 2. Resource Management Inside the resources section of a PodSpec: Requests: What the container needs. The scheduler uses this value to find a node. Limits: What the container is allowed to use. Enforced at runtime by the Cgroup. LimitRange: A cluster resource to enforce default, min, and max requests/limits for all Pods in a namespace. ...

November 29, 2023 · 2 min

Understanding Kubernetes Etcd

1. Overview etcd is a distributed, reliable key-value store for the most critical data of a distributed system. Based on the Raft consensus algorithm, it provides strong consistency and high availability. In Kubernetes, etcd is the single source of truth. It stores: Cluster configuration (API objects). Actual state info (Which pods are running where). Service discovery and config sharing. Backups and recovery data. 2. Basic Operations (etcdctl) Member List: $ etcdctl member list Storing Data: $ etcdctl put key value Retrieving Data: $ etcdctl get key Watching: $ etcdctl watch key (Triggers a notification when the key changes). 3. Leases and TTL A Lease is a mechanism for expiring keys after a set time. ...

November 25, 2023 · 2 min

Understanding Kubernetes ConfigMap

Local Setup (Docker Desktop) If you are using Docker Desktop and Kubernetes won’t start, common fixes include: Adding Chinese images mirrors. Using helper scripts to pull the required K8s images locally. Verify your setup: $ kubectl get nodes $ kubectl cluster-info Pods and Services A Pod is the smallest deployable unit. Let’s start an Nginx deployment: $ kubectl create deployment nginx --image=nginx $ kubectl expose deployment nginx --port=80 --type=LoadBalancer $ curl 127.0.0.1:80 ConfigMap: Decoupling Config from Code A ConfigMap stores non-confidential data in key-value pairs. This allows you to change environment variables or configuration files without rebuilding the container image. ...

November 16, 2023 · 2 min

Microservice Architecture in the Cloud-Native Era

This sharing mainly focuses on the following four topics: What is Cloud Native? Why use Cloud-Native architecture? The concept of Microservices Technical selection for Microservices What is Cloud Native? Cloud Computing and Cloud Native Cloud computing is different from traditional self-built computer rooms. Cloud computing abstracts computing into infrastructure and distributes it through the network. Thanks to the infinite scaling capability of cloud computing, “cloud computing” is just like a water plant; we can get water at any time, unlimited, and pay according to our water consumption. Here are the five basic characteristics of cloud computing. ...

November 30, 2021 · 11 min

Microservice Design Principles Based on Spring Cloud

1. The Core Philosophy The shift from monolith to microservices is like moving from a “battleship” to a “fleet.” Breaking down a large application into small, independent services provides: Agility: Rapid deployment cycles. Resilience: Fault isolation (one service crash doesn’t kill the whole app). Scalability: Scaling only the bottleneck services. 2. The Cost of Decentralization Microservices are not a solution for everyone. They introduce: Network Latency: Inter-service calls are slower than in-memory calls. Data Consistency: Distributed transactions are complex (CAP Theorem). Operational Complexity: You need robust monitoring and logging. 3. Spring Cloud Ecosystem Spring Cloud provides a suite of tools for the common “pain points” of microservices: ...

September 14, 2020 · 2 min