[{"content":"","date":"10 May 2026","externalUrl":null,"permalink":"/categories/","section":"Categories","summary":"","title":"Categories","type":"categories"},{"content":"","date":"10 May 2026","externalUrl":null,"permalink":"/docs/","section":"Docs","summary":"","title":"Docs","type":"docs"},{"content":"","date":"10 May 2026","externalUrl":null,"permalink":"/categories/kubernetes/","section":"Categories","summary":"","title":"Kubernetes","type":"categories"},{"content":" What is Kubernetes? # Kubernetes, (originally developed by Google), is an open-source container orchestration platform for automating deployment, scaling, and management of containerized applications.\nThink of it like this: Imagine that you run a restaurant chain.\nYou don\u0026rsquo;t manually assign every cook, waiter, and cashier to every location, do you? No, you have a manager who figures out staffing, handles sick days, opens new locations when demand spikes, and closes them when it\u0026rsquo;s slow.\nKubernetes is that manager, but from a software perspective.\nWhy use Kubernetes in the first place? # Consider the following scenario:\nYou are running a set of containerized applications with Docker in a production environment, suddenly, one of your Docker containers goes down, your application is down, you have downtime in production what do you do?\nIn such scenario, Kubernetes could attempt to restart the container once it detected that it was down, or, it could be configured to run multiple replicas of the same container simultaneously, load balancing incoming traffic across the replicas, or, it could simply rollback to a previous deployed version.\nHere are some of the common challenges that Kubernetes addresses:\nAutomatic recovery: Detects failed containers and restarts or replaces them to minimize downtime; Replicas and load balancing: Runs multiple replicas of a service and distributes traffic across them to maintain availability under load or when instances fail. Declarative deployments and rollbacks: Applies updates declaratively and can perform rolling updates or roll back to a previous version if problems are detected. Scaling: Scales applications horizontally (automatic or manual) to match demand and supports cluster autoscaling for infrastructure capacity. Service discovery and stable networking: Provides stable network identities for services and internal service discovery so components can communicate reliably. Resource-aware scheduling: Places workloads onto nodes based on resource requests, constraints, affinities, taints/tolerations, and QoS requirements for efficient utilization. Configuration and secret management: Separates configuration and secrets from images and injects them securely into running containers. Stateful workload support and persistent storage: Manages persistent volumes and stateful sets for databases and other stateful services. Self-healing and declarative reconciliation: Continuously reconciles actual cluster state to the declared desired state, maintaining consistency and reducing manual intervention. How is Kubernetes built? # Kubernetes has a master-worker architecture, i.e. A control plane that makes decisions, and worker nodes that do the actual work.\nThe control plane and worker nodes form what is commonly known as a Kubernetes cluster:\nKubernetes Cluster Both the control plane and worker nodes are made up of distinct components, each with a specific responsibility.\nRather than a single monolithic process, Kubernetes is a collection of small, focused processes that work together, each one in charge of different things.\nThis design has a key benefit: if one component fails, the others keep running. The cluster can often self-recover without any manual intervention.\nControl Plane # The control plane is the brain of the cluster. It makes global decisions about the cluster\u0026rsquo;s desired state and continuously works to achieve it.\nIt is made up of the following components:\nAPI Server : The \u0026ldquo;front door\u0026rdquo; of the cluster. Every command you run goes through here. It\u0026rsquo;s a REST API that all other components talk to. etcd : A fast, lightweight key-value database that stores the entire state of the cluster. If Kubernetes were a person, etcd would be its long-term memory. Scheduler : Responsible for distributing work, (or containers), across multiple nodes. It scans for newly created containers and then picks the best worker node to run them on (based on available CPU, memory, rules, etc.). Controller Manager : The controller manager is like a collection of controllers running in loops, each responsible for making sure that the right number of pods are running, handling node failures, managing rolling updates, etc. Worker Nodes # Worker nodes are the muscle of the cluster, they run your applications. Each node is managed by the control plane and is made up of the following components:\nkubelet : An agent that runs on every node. It receives instructions from the control plane and ensures the assigned pods are running and healthy. If a container crashes, the kubelet restarts it locally without involving the control plane. kube-proxy : Manages networking rules on the node, ensuring traffic is correctly routed to the right pods regardless of which node they are running on. Container Runtime : The actual engine that runs containers. Kubernetes doesn\u0026rsquo;t care which one, it supports Docker, containerd, CRI-O, etc. Issuing commands to the cluster # To interact with the cluster, you must first install the kubectl, (\u0026ldquo;kube control\u0026rdquo;), CLI tool.\nInstalling kubectl # macOS Linux Install using brew:\nbrew install kubectl kubectl version --client For command autocompletion, add the following to your .zshrc:\nif [[ -z \u0026#34;$_compinit_done\u0026#34; ]]; then autoload -Uz compinit compinit _compinit_done=1 fi if command -v kubectl \u0026gt;/dev/null 2\u0026gt;\u0026amp;1; then # Initialize the kubectl completion script source \u0026lt;(kubectl completion zsh) fi See the official documentation. Then, assuming that you have a Kubernetes cluster up \u0026amp; running, you must configure the context so that kubectl knows which cluster to talk to and how to authenticate with it.\nWhat is a kubectl context? A context is a named combination of a cluster, a user, and optionally a namespace, stored in ~/.kube/config. Switching context switches which cluster kubectl talks to.\nConfiguring a new kubectlcontext # First, obtain the following values from your cluster\u0026rsquo;s kubeconfig:\ncertificate-authority-data — the cluster\u0026rsquo;s CA certificate client-certificate-data — your client certificate client-key-data — your private key Decode each value and save it to a temporary file:\necho \u0026lt;certificate-authority-data\u0026gt; | base64 -d \u0026gt; /tmp/k8s-ca.crt echo \u0026lt;client-certificate-data\u0026gt; | base64 -d \u0026gt; /tmp/k8s-client.crt echo \u0026lt;client-key-data\u0026gt; | base64 -d \u0026gt; /tmp/k8s-client.key Then register the cluster, credentials, and context with kubectl:\n# Register the cluster kubectl config set-cluster \u0026lt;context-name\u0026gt; \\ --server=https://\u0026lt;cluster-ip\u0026gt;:6443 \\ --embed-certs=true \\ --certificate-authority=/tmp/k8s-ca.crt # Register your credentials kubectl config set-credentials \u0026lt;credentials-name\u0026gt;\\ --embed-certs=true \\ --client-certificate=/tmp/k8s-client.crt \\ --client-key=/tmp/k8s-client.key # Create a context linking the cluster and credentials kubectl config set-context \\ --cluster=\u0026lt;context-name\u0026gt; \\ --user=\u0026lt;credentials-name\u0026gt; Clean up temporary files:\nrm /tmp/k8s-ca.crt /tmp/k8s-client.crt /tmp/k8s-client.key Finally, activate the context and verify the connection:\nkubectl config use-context \u0026lt;context-name\u0026gt; kubectl get nodes If configured correctly, kubectl get nodes returns the list of nodes in your cluster:\nNAME STATUS ROLES AGE VERSION my-cluster Ready control-plane 5m v1.35.4+k3s1 ","date":"10 May 2026","externalUrl":null,"permalink":"/docs/kubernetes/","section":"Docs","summary":"","title":"Kubernetes","type":"docs"},{"content":"","date":"10 May 2026","externalUrl":null,"permalink":"/tags/kubernetes/","section":"Tags","summary":"","title":"Kubernetes","type":"tags"},{"content":"","date":"10 May 2026","externalUrl":null,"permalink":"/","section":"Patrício Simões","summary":"","title":"Patrício Simões","type":"page"},{"content":"","date":"10 May 2026","externalUrl":null,"permalink":"/tags/","section":"Tags","summary":"","title":"Tags","type":"tags"},{"content":"","externalUrl":null,"permalink":"/about/","section":"Patrício Simões","summary":"","title":"","type":"page"},{"content":"","externalUrl":null,"permalink":"/authors/","section":"Authors","summary":"","title":"Authors","type":"authors"},{"content":"","externalUrl":null,"permalink":"/series/","section":"Series","summary":"","title":"Series","type":"series"}]