{"id":22672,"date":"2025-07-02T11:48:29","date_gmt":"2025-07-02T11:48:29","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=22672"},"modified":"2025-07-02T11:48:59","modified_gmt":"2025-07-02T11:48:59","slug":"details-kubernetes-components-in-master-worker","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/details-kubernetes-components-in-master-worker\/","title":{"rendered":"Kubernetes Components in Master &amp; Worker"},"content":{"rendered":"\n<p>Here is a <strong>very comprehensive, detailed tutorial\/guide<\/strong> explaining each Kubernetes cluster architecture component you\u2019ve listed. This guide is suitable for learning, interviews, or team documentation, and each component is clearly explained with details on how it works, its purpose, and practical usage.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">Kubernetes Cluster Architecture: Complete Guide<\/h1>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">1. <strong>Overview of Kubernetes Cluster Architecture<\/strong><\/h2>\n\n\n\n<p>A Kubernetes (K8s) cluster consists of several components working together to manage, orchestrate, and scale containerized applications. The architecture is designed to be modular, highly available, and scalable. The main building blocks are:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">Workstation \u2192 Master Node(s) \u2192 Worker Node(s)\n<\/code><\/span><\/pre>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">2. <strong>Workstation<\/strong><\/h2>\n\n\n\n<p>This is the <strong>user&#8217;s machine or environment<\/strong> used to manage and interact with the Kubernetes cluster. Most operational tasks, cluster management, and resource definitions start here.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Key Tools on Workstation<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">a. <strong>kubectl<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Description:<\/strong><br><code>kubectl<\/code> is the command-line tool for interacting with the Kubernetes API server. It allows you to deploy applications, inspect and manage cluster resources, and view logs.<\/li>\n\n\n\n<li><strong>Common Commands:<\/strong>\n<ul class=\"wp-block-list\">\n<li><code>kubectl get pods<\/code><\/li>\n\n\n\n<li><code>kubectl apply -f deployment.yaml<\/code><\/li>\n\n\n\n<li><code>kubectl logs &lt;pod-name><\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>How it works:<\/strong><br>Communicates with the Kubernetes API server over HTTPS, using kubeconfig for authentication and cluster context.<\/li>\n\n\n\n<li><strong>Practical Example:<\/strong> <code>kubectl get nodes kubectl describe service my-service<\/code><\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">b. <strong>YAML<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Description:<\/strong><br>YAML files are used to <strong>define the desired state<\/strong> of Kubernetes resources (Pods, Deployments, Services, etc.) in a declarative way.<\/li>\n\n\n\n<li><strong>How it works:<\/strong><br>You write a resource definition in a <code>.yaml<\/code> file and use <code>kubectl apply -f file.yaml<\/code> to create or update resources.<\/li>\n\n\n\n<li><strong>Example YAML:<\/strong> <\/li>\n\n\n\n<li><code>apiVersion: v1 kind: Pod metadata: name: nginx-pod spec: containers: - name: nginx image: nginx:latest<\/code><\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">3. <strong>Master Node<\/strong><\/h2>\n\n\n\n<p>The <strong>Master Node<\/strong> is the brain of the Kubernetes cluster. It manages the cluster state, schedules workloads, and handles API requests. In production, you typically have more than one master for high availability.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Core Components on Master Node<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">a. <strong>API Server<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>What it is:<\/strong><br>The API Server is the <strong>central management point<\/strong> for the Kubernetes cluster. It exposes the Kubernetes API, which is a RESTful interface used by all other components and by <code>kubectl<\/code>.<\/li>\n\n\n\n<li><strong>How it works:<\/strong>\n<ul class=\"wp-block-list\">\n<li>Receives requests (create, update, delete, get) from users and other components.<\/li>\n\n\n\n<li>Validates and processes API calls.<\/li>\n\n\n\n<li>Stores the resulting state in etcd.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Deployed as:<\/strong><br>Runs as a <strong>Pod<\/strong> on the master node (using an image from the Google Registry).<\/li>\n\n\n\n<li><strong>Practical Notes:<\/strong>\n<ul class=\"wp-block-list\">\n<li>All communication in the cluster passes through the API Server.<\/li>\n\n\n\n<li>Secures communication via SSL\/TLS and authenticates users.<\/li>\n\n\n\n<li>Example command to access: <code>kubectl get nodes<\/code> (This command communicates with the API server.)<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">b. <strong>etcd<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>What it is:<\/strong><br>A <strong>distributed key-value store<\/strong> that holds the entire configuration and state of the cluster.<\/li>\n\n\n\n<li><strong>How it works:<\/strong>\n<ul class=\"wp-block-list\">\n<li>The &#8220;single source of truth&#8221; for the cluster\u2019s desired and actual state.<\/li>\n\n\n\n<li>Stores objects like pods, deployments, configmaps, secrets, etc.<\/li>\n\n\n\n<li>Highly available in production with a cluster of etcd nodes.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Deployed as:<\/strong><br>Runs as a <strong>Pod<\/strong> on the master node (using an image from the Google Registry).<\/li>\n\n\n\n<li><strong>Backup:<\/strong><br>Essential to regularly back up etcd for disaster recovery.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">c. <strong>Controller Manager<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>What it is:<\/strong><br>The <strong>brains behind state management<\/strong> in Kubernetes. Runs controllers that ensure the cluster is always at the desired state.<\/li>\n\n\n\n<li><strong>How it works:<\/strong>\n<ul class=\"wp-block-list\">\n<li>Watches etcd and the API Server for changes.<\/li>\n\n\n\n<li>Runs controllers such as:\n<ul class=\"wp-block-list\">\n<li>Replication Controller (ensures correct number of pods)<\/li>\n\n\n\n<li>Node Controller (tracks node health)<\/li>\n\n\n\n<li>Endpoint Controller (populates endpoints for services)<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Takes action if the current state diverges from the desired state (e.g., creates new pods if one crashes).<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Deployed as:<\/strong><br>Runs as a <strong>Pod<\/strong> on the master node.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">d. <strong>Scheduler<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>What it is:<\/strong><br>Decides <strong>which worker node will run a new pod<\/strong> based on resource requirements and policies.<\/li>\n\n\n\n<li><strong>How it works:<\/strong>\n<ul class=\"wp-block-list\">\n<li>Watches for newly created pods that don\u2019t have a node assigned.<\/li>\n\n\n\n<li>Selects an appropriate node based on available CPU\/memory, taints\/tolerations, affinity\/anti-affinity, etc.<\/li>\n\n\n\n<li>Updates the pod spec to bind it to the selected node.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Deployed as:<\/strong><br>Runs as a <strong>Pod<\/strong> on the master node.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">e. <strong>kube-proxy<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>What it is:<\/strong><br>Handles <strong>network proxying and load balancing<\/strong> for services in Kubernetes.<\/li>\n\n\n\n<li><strong>How it works:<\/strong>\n<ul class=\"wp-block-list\">\n<li>Runs on every node (both master and worker nodes).<\/li>\n\n\n\n<li>Maintains network rules and manages traffic routing to pods.<\/li>\n\n\n\n<li>Enables access to Kubernetes services via ClusterIP, NodePort, or LoadBalancer.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Deployed as:<\/strong><br>Runs as a <strong>Pod<\/strong> on both master and worker nodes.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Supporting Tools on Master Node<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>kubelet:<\/strong><br>Node agent that ensures containers are running as specified in PodSpecs. (More on this in Worker Node section.)<\/li>\n\n\n\n<li><strong>Docker\/ContainerD:<\/strong><br>Container runtimes that pull container images and run containers. Kubernetes supports both; ContainerD is becoming the standard.<\/li>\n\n\n\n<li><strong>kubectl:<\/strong><br>Used on master for troubleshooting and cluster management.<\/li>\n\n\n\n<li><strong>kubeadm:<\/strong><br>Tool for bootstrapping and managing Kubernetes clusters.\n<ul class=\"wp-block-list\">\n<li><code>kubeadm init<\/code> is used to initialize a new master node.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Master Node Setup Example<\/strong><\/h3>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">sudo kubeadm init --pod-network-cidr=<span class=\"hljs-number\">10.244<\/span><span class=\"hljs-number\">.0<\/span><span class=\"hljs-number\">.0<\/span>\/<span class=\"hljs-number\">16<\/span>\n<span class=\"hljs-comment\"># Follow the output instructions to set up kubectl config and join worker nodes.<\/span>\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">4. <strong>Worker Node<\/strong><\/h2>\n\n\n\n<p>The <strong>Worker Node<\/strong> is where application workloads run. These nodes are registered with the cluster and managed by the control plane (masters).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Key Components on Worker Node<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">a. <strong>kubelet<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>What it is:<\/strong><br>The <strong>node agent<\/strong>. Ensures that the containers described in PodSpecs are running and healthy.<\/li>\n\n\n\n<li><strong>How it works:<\/strong>\n<ul class=\"wp-block-list\">\n<li>Communicates with the API Server to receive pod specs.<\/li>\n\n\n\n<li>Starts\/stops containers as needed.<\/li>\n\n\n\n<li>Reports node and pod status back to the master.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">b. <strong>kube-proxy<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>What it is:<\/strong><br>As described above, enables network communication and load balancing for services on each node.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">c. <strong>Container Runtime (Docker\/ContainerD)<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>What it is:<\/strong><br>The engine responsible for running containers.<\/li>\n\n\n\n<li><strong>How it works:<\/strong>\n<ul class=\"wp-block-list\">\n<li>Pulls images from container registries (e.g., Google Registry, Docker Hub).<\/li>\n\n\n\n<li>Starts, stops, and manages the lifecycle of containers.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">d. <strong>kubectl<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Optional on worker:<\/strong><br>Can be used for troubleshooting but not required for basic node function.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">e. <strong>kubeadm<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>How it&#8217;s used:<\/strong>\n<ul class=\"wp-block-list\">\n<li>Used to join the worker node to the cluster: <code>sudo kubeadm join &lt;master-ip>:&lt;port> --token &lt;token> --discovery-token-ca-cert-hash sha256:&lt;hash><\/code><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Worker Node Setup Example<\/strong><\/h3>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml\"># Install kubeadm, kubelet, containerd\/docker\n# Join cluster (command given by kubeadm init on master)\nsudo kubeadm join <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">MASTER_IP<\/span>&gt;<\/span>:6443 --token <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">TOKEN<\/span>&gt;<\/span> --discovery-token-ca-cert-hash sha256:<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">HASH<\/span>&gt;<\/span>\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">5. <strong>Summary Table: Components and Their Functions<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Component<\/th><th>Runs On<\/th><th>Description \/ Purpose<\/th><\/tr><\/thead><tbody><tr><td>kubectl<\/td><td>Workstation<\/td><td>CLI tool to manage cluster and resources<\/td><\/tr><tr><td>YAML<\/td><td>Workstation<\/td><td>Declarative configuration files<\/td><\/tr><tr><td>API Server<\/td><td>Master Node<\/td><td>Cluster gateway, exposes Kubernetes API<\/td><\/tr><tr><td>etcd<\/td><td>Master Node<\/td><td>Distributed key-value store for cluster state<\/td><\/tr><tr><td>Controller Manager<\/td><td>Master Node<\/td><td>Maintains desired state via controllers<\/td><\/tr><tr><td>Scheduler<\/td><td>Master Node<\/td><td>Assigns pods to worker nodes<\/td><\/tr><tr><td>kube-proxy<\/td><td>Both<\/td><td>Manages networking, service load balancing<\/td><\/tr><tr><td>kubelet<\/td><td>Both<\/td><td>Ensures container health and execution<\/td><\/tr><tr><td>Docker\/ContainerD<\/td><td>Both<\/td><td>Container runtime to run pods<\/td><\/tr><tr><td>kubeadm<\/td><td>Both<\/td><td>Bootstrap and manage cluster<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">6. <strong>How Everything Works Together: Flow Example<\/strong><\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>User writes a YAML manifest<\/strong> on the workstation.<\/li>\n\n\n\n<li><strong>User applies manifest<\/strong> with <code>kubectl apply -f file.yaml<\/code>.<\/li>\n\n\n\n<li><strong>kubectl<\/strong> sends the request to the <strong>API Server<\/strong>.<\/li>\n\n\n\n<li><strong>API Server<\/strong> stores configuration\/state in <strong>etcd<\/strong>.<\/li>\n\n\n\n<li><strong>Controller Manager<\/strong> notices a new deployment is needed.<\/li>\n\n\n\n<li><strong>Scheduler<\/strong> assigns pods to available <strong>worker nodes<\/strong>.<\/li>\n\n\n\n<li><strong>kubelet<\/strong> on worker nodes creates and manages containers via Docker\/ContainerD.<\/li>\n\n\n\n<li><strong>kube-proxy<\/strong> sets up networking rules so services are reachable.<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">7. <strong>Conclusion &amp; Best Practices<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Separate control plane and worker responsibilities<\/strong> for security and reliability.<\/li>\n\n\n\n<li><strong>Always secure etcd and take regular backups.<\/strong><\/li>\n\n\n\n<li><strong>Use declarative YAML for consistent, version-controlled cluster management.<\/strong><\/li>\n\n\n\n<li><strong>Leverage kubeadm for standard, reliable cluster bootstrapping.<\/strong><\/li>\n\n\n\n<li><strong>Use kubectl with RBAC (Role-Based Access Control) to restrict access.<\/strong><\/li>\n\n\n\n<li><strong>Regularly update cluster components for security and features.<\/strong><\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here is a very comprehensive, detailed tutorial\/guide explaining each Kubernetes cluster architecture component you\u2019ve listed. This guide is suitable for learning, interviews, or team documentation, and each component is clearly&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[4859],"tags":[],"class_list":["post-22672","post","type-post","status-publish","format-standard","hentry","category-kubernetes"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/22672","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=22672"}],"version-history":[{"count":7,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/22672\/revisions"}],"predecessor-version":[{"id":49919,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/22672\/revisions\/49919"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=22672"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=22672"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=22672"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}