User Tools

Site Tools


raspberry_pi_cluster:kbs

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
raspberry_pi_cluster:kbs [2025/02/07 11:38] – created 85.219.17.206raspberry_pi_cluster:kbs [2025/02/07 11:56] (current) jmbargallo
Line 1: Line 1:
-# Installing K3s+ ======   Kubernetes summary ======
  
-## Master node+======     Introduction ======
  
-We are going to install the K3s version of Kubernetes, that is lightweight enough for out single board computers to handle. Use the following command to download and initialize K3s’ master node. 
  
-    curl -sfL https://get.k3s.io | sh -s - --write-kubeconfig-mode 644 --disable servicelb --token some_random_password --node-taint CriticalAddonsOnly=true:NoExecute --bind-address 192.168.0.80 --disable-cloud-controller --disable local-storage+Kubernetes has become the de facto standard for container orchestration and management, powering many modern applications and servicesAs its popularity continues to grow, so does the need for individuals skilled in KubernetesIn this blog post, we’ll explore the top 75 Kubernetes questions and answers, covering a range of topics from basic concepts to advanced techniquesWhether you’re a beginner or an expert, these questions and answers will help you better understand Kubernetes and hone your skills.
  
-Some explanations:+    What is Kubernetes? 
 +Kubernetes, often abbreviated as K8s, is an open-source platform for automating deployment, scaling, and management of containerized applications. It was originally developed by Google and is now maintained by the Cloud Native Computing Foundation (CNCF).
  
---write-kubeconfig-mode 644 - This is the mode that we want to use for the kubeconfig fileIts optionalbut needed if you want to connect to Rancher manager later on.+    What is a container? 
 +A container is a lightweight, stand-alone, and executable software package that includes everything needed to run a piece of software, including the code, runtime, system tools, libraries, and settings. 
 +    What are the main components of Kubernetes?  
 +The main components of Kubernetes are the control planeworker nodes, and the Kubernetes  
 +API. 
 +    What is the control plane?  
 +The control plane is the set of components that manage the overall state of the cluster, including the API server, etcd datastore, controller manager, and the kube-scheduler. 
 +    What are worker nodes? 
 +Worker nodes are the machines that run containers. Each worker node runs the container runtime (such as Docker) and the kubelet agent, which communicates with the control plane. 
 +    What is a Pod?  
 +A Pod is the smallest and simplest unit in Kubernetes. It represents a single instance of a running process in a cluster and can contain one or more containers. 
 +    What is a ReplicaSet?
  
---disable servicelb - This is the flag that we want to use to disable the service load balancer.+A ReplicaSet is a higher-level abstraction over Pods that ensures a specified number of Pod replicas are running at any given time. 
 +    What is a Deployment? 
  
---token - This is the token that we want to use to connect to the K3s master node. Choose random passwordbut keep remember it.+A Deployment is a higher-level abstraction over ReplicaSetsproviding declarative updates for Pods and ReplicaSetsIt allows you to perform rolling updates, rollbacks, and scaling of your application. 
 +    What is a Service?
  
---node-taint - This is the flag that we want to use to add taint to the K3s master nodeI'll explain taints later onbut it will mark the node to not run any containers except the ones that are critical.+A Service is an abstraction that defines logical set of Pods and a policy to access themIt provides a stable IP address and DNS nameallowing clients to discover and communicate with the Pods. 
 +    What are ConfigMaps and Secrets? 
  
---bind-address - This is the flag that we want to use to bind the K3s master node to specific IP address+ConfigMaps and Secrets are Kubernetes objects used to store non-sensitive and sensitive configuration data, respectively. They decouple configuration data from container images, making it easier to update and manage. 
- +    What is Ingress? 
---disable-cloud-controller This is the flag that we want to use to disable the K3s cloud controllerI don't think I need it+Ingress is an API object that manages external access to the services in cluster, typically through HTTP. It provides load balancing, SSL termination, and name-based virtual hosting
- +    What are StatefulSets? 
---disable local-storage - This is the flag that we want to use to disable the K3s local storage (for the moment). +StatefulSets are Kubernetes objects used to manage stateful applications, ensuring a unique and stable hostname for each Pod, like web-0, web-1, etc. They also provide guarantees about the ordering and uniqueness of Pods. 
- +    What are DaemonSets? 
-We can look at Kubernetes nodes by using the following command: +DaemonSets are Kubernetes objects that ensure a copy of a specific Pod is running on all (or some) nodes in a cluster, usually for system-level services like log collectors or monitoring agents. 
- +    What is the Kubernetes API? 
-    root@control01:~# kubectl get nodes +The Kubernetes API is the primary interface for communicating with and managing a Kubernetes clusterIt exposes a RESTful interface for creating, updating, and deleting Kubernetes objects
-    NAME        STATUS   ROLES                  AGE   VERSION +    What is kubectl? 
-    master      Ready    control-plane,master   23s   v1.23.6+k3s1 +Kubectl is the command-line tool used to interact with the Kubernetes API server, allowing you to manage Kubernetes resources. 
- +    What are labels and selectors? 
-## Workers +Labels are key-value pairs attached to Kubernetes objects, used for organizing and selecting subsets of objects. Selectors are queries that match objects based on their labels, enabling you to filter and perform actions on specific groups of objects. 
- +    What are namespaces? 
-To install the worker nodes, we first need to obtain the K3S_TOKEN from the master node. Execute the command shown below to retrieve it: +Namespaces are a way to divide cluster resources between multiple users or teams. They provide a scope for names, allowing you to have multiple objects with the same name in different namespaces. 
- +    What is a horizontal pod autoscaler (HPA)
- +A horizontal pod autoscaler (HPA) is a Kubernetes component that automatically scales the number of Pods in a Deployment or ReplicaSet based on observed CPU or custom metric utilization
-    # get node-token from master node +    What is a vertical pod autoscaler (VPA)? 
-    sudo cat /var/lib/rancher/k3s/server/node-token +A vertical pod autoscaler (VPA) is a Kubernetes component that automatically adjusts the CPU and memory resources allocated to Pods based on their actual resource usage. 
- +    What is Helm? 
-    # The result is something likes this +Helm is a package manager for Kubernetes, allowing you to define, install, and manage Kubernetes applications using Helm charts, which are versioned, pre-configured application packages. 
-    K109d3581cbb7da137b25c2e2ea0a47e941cdb2380799f9cd5840fd059abac1b9a6::server:6961dd195c22c88b06d38a238d7ebc4b +    What is a Custom Resource Definition (CRD)?  
- +A Custom Resource Definition (CRD) allows you to define and manage custom resources in Kubernetes, extending its functionality with new API objects tailored to your specific use case. 
-We need to join some workers the easyest (not the best way to do itis install K3s on every node: +    What is a Kubernetes Operator? 
- +A Kubernetes Operator is a method for extending Kubernetes functionality using custom resources and custom controllers. Operators define custom resources and include the logic to manage their lifecycle, often encoding domain-specific knowledge about applications. 
-    curl -sfL https://get.k3s.io | K3S_URL=https://192.168.0.80:6443 K3S_TOKEN="K109d3581cbb7da137b25c2e2ea0a47e941cdb2380799f9cd5840fd059abac1b9a6::server:6961dd195c22c88b06d38a238d7ebc4b" sh - +    What is RBAC (Role-Based Access Control)? 
- +RBAC is a security feature in Kubernetes that allows you to define and enforce access policies for resources based on user roles. It uses Role and ClusterRole objects to define permissions and RoleBinding and ClusterRoleBinding objects to grant those permissions to users or groups. 
-The IP and the token were the ones in the master nodeit´s necessary to adapt it for every particular installation +    What is a persistent volume (PV) and a persistent volume claim (PVC)? 
- +A persistent volume (PV) is a Kubernetes abstraction for storage resources in a clusterwhile a persistent volume claim (PVC) is a request for storage resources by a userPVs and PVCs allow you to manage storage resources independently of Pods and their lifecycle
-Now give it few moments to join the cluster. You can watch the progress by using the following command: +    What is a Kubernetes network policy? 
- +A Kubernetes network policy is a security feature that allows you to define and enforce rules for Pod communication within a cluster. It enables you to control ingress and egress traffic for individual Pods or groups of Pods based on labels and selectors. 
-    watch kubectl get nodes +    What is a Kubernetes Cluster? 
- +A Kubernetes cluster is a set of machines, or nodes, that work together to manage and run containerized applications. It consists of control plane components and worker nodes, providing a unified platform for deploying, scaling, and managing containers. 
-To quit watch use Ctrl+c +    What is a node affinity and anti-affinity? 
- +Node affinity and anti-affinity are rules that influence how Pods are scheduled onto nodes in a cluster. Affinity rules encourage Pods to be scheduled on nodes with specific characteristics, while anti-affinity rules discourage Pods from being scheduled on nodes with specific characteristics. 
-In the endit should look something like this: +    What is a taint and a toleration? 
- +Taints are attributes applied to nodes that express that the node should not accept certain Pods, while tolerations are attributes applied to Pods that allow them to be scheduled on tainted nodesThis mechanism ensures that Pods are not scheduled on inappropriate nodes. 
-    root@control01:~# kubectl get nodes +    What is a readiness probe? 
-    NAME        STATUS   ROLES                  AGE     VERSION +A readiness probe is a diagnostic check that determines if a container is ready to serve traffic. If a container fails the readiness probe, the Pod will not receive traffic from a Service until it passes the check. 
-    worker01    Ready    <none>                 71s     v1.23.6+k3s1 +    What is a liveness probe? 
-    worker02    Ready    <none>                 72s     v1.23.6+k3s1 +A liveness probe is a diagnostic check that determines if a container is running properly. If a container fails the liveness probe, Kubernetes will restart the container, attempting to resolve the issue. 
-    worker03    Ready    <none>                 61s     v1.23.6+k3s1 +    What is a CronJob? 
-    master      Ready    control-plane,master   3m45s   v1.23.6+k3s1 +A CronJob is a Kubernetes object that allows you to run a specific job on a scheduled basis, based on a cron expression. It is useful for tasks like backups, report generation, or other periodic tasks. 
- +    What is a Job? 
-# Setting role/labels +A Job is a Kubernetes object that represents a finite task that runs one or more Pods to completion. Jobs are useful for running batch processes or other tasks that need to run to completion, rather than continuously running services. 
- +    What is a rolling update? 
-We can tag our cluster nodes to give them labels+A rolling update is a deployment strategy that incrementally updates the Pods of a Deployment or StatefulSet with minimal impact on application availability. It replaces old Pods with new ones gradually, ensuring that a specified number of replicas are always available during the update process. 
- +    What is a canary deployment? 
-Let's add this tag key:value: kubernetes.io/role=worker to worker nodes. This is more cosmetic, to have nice output from kubectl get nodes+A canary deployment is a deployment strategy that involves deploying a new version of an application alongside the stable version, directing a small percentage of traffic to the new version. This allows you to test and validate the new version before gradually rolling it out to all users. 
- +    What is a blue-green deployment?  
-    kubectl label nodes worker01 kubernetes.io/role=worker  +A blue-green deployment is a deployment strategy that involves running two separate environments, “blue” and “green,” with identical configurations. When deploying a new version, the new version is deployed to the inactive environment, and once tested and verified, traffic is switched to the new environment. 
-    kubectl label nodes worker02 kubernetes.io/role=worker +    What is a StatefulSet headless service? 
-    kubectl label nodes worker03 kubernetes.io/role=worker +A headless service is a Service without a ClusterIP, used for stateful applications managed by a StatefulSet. It allows each Pod to have its own DNS hostname, enabling direct Pod-to-Pod communication without relying on a single ClusterIP. 
-    #Another label/tagI will use this one to tell deployments  +    What is Kubernetes Federation? 
-    #to prefer nodes where node-type equals workers.  +Kubernetes Federation is a feature that allows you to synchronize and manage resources across multiple Kubernetes clustersIt enables you to create a single, unified control plane for managing applications deployed in multiple clusters. 
-    #The node-type is our chosen name for keyyou can call it whatever+    What is a Kubernetes StorageClass? 
-    kubectl label nodes worker01 node-type=worker +A StorageClass is a Kubernetes object that defines the types of storage available in a clusterIt allows administrators to define different classes of storage with varying performance and cost characteristics, enabling users to request storage that meets their specific needs
-    kubectl label nodes workerS02 node-type=worker+    What is a Kubernetes Volume? 
 +A Kubernetes volume is a directory accessible to containers within a Pod. Volumes enable data to be shared between containers or to persist data beyond the lifetime of a container. 
 +    What is container resource management in Kubernetes? 
 +Container resource management in Kubernetes refers to the process of managing the allocation of CPU, memory, and other resources to containers within a Pod. By setting resource requests and limits, you can ensure that containers have the necessary resources to function optimally while preventing resource starvation or over-allocation. 
 +    What are init containers? 
 +Init containers are special-purpose containers that run before the main containers in a Pod. They are often used to perform setup tasks, such as downloading dependencies, configuring the environmentor validating configuration data before the main application starts. 
 +    What is a Kubernetes Service Account? 
 +A Service Account is a Kubernetes object that represents an identity for processes running within a Pod. Service Accounts can be used to provide authentication and authorization for accessing the Kubernetes API or other resources within a cluster. 
 +    What is a Kubernetes Ingress Controller? 
 +A Kubernetes Ingress Controller is a component that manages the routing of external traffic to Services within a cluster based on Ingress rulesIt watches for Ingress resources and updates the underlying load balancer or proxy configuration accordingly. 
 +    What is a Pod Disruption Budget (PDB)?  
 +A Pod Disruption Budget (PDB) is a Kubernetes object that limits the number of Pods that can be voluntarily evicted from a ReplicaSet, Deployment, or StatefulSet, ensuring high availability during maintenance operations, such as node upgrades or scaling events. 
 +    What is kube-proxy? 
 +Kube-proxy is a network proxy that runs on each node in a Kubernetes cluster, responsible for maintaining network rules and facilitating service discovery and load balancing for Services. 
 +    What is kubelet? 
 +Kubelet is an agent that runs on each worker node in a Kubernetes cluster, responsible for ensuring that the containers within Pods are running and healthy, and communicating with the control plane. 
 +    What is etcd? 
 +Etcd is a distributed, consistent key-value store used by Kubernetes to store the configuration data of the cluster, acting as the primary datastore for the control plane components. 
 +    What are Kubernetes Annotations? 
 +Kubernetes Annotations are key-value pairs attached to objects that can be used to store arbitrary, non-identifying metadata. Unlike labels, annotations are not used for selecting objects but can be useful for storing additional information about an object, such as a description or a timestamp. 
 +    What is a Kubernetes Self-Healing System? 
 +A Kubernetes self-healing system refers to the built-in mechanisms that automatically detect and resolve issues within the cluster, such as restarting failed containers, rescheduling Pods on failed nodes, or scaling applications based on resource usage. 
 +    What is a Kubernetes Persistent Storage? 
 +Kubernetes persistent storage refers to the various storage solutions available for storing data that needs to persist beyond the lifetime of a container or Pod. This includes Persistent Volumes, Persistent Volume Claims, and Storage Classes, which allow you to manage and provision storage resources in a consistent and efficient manner. 
 +    What is a Kubernetes Admission Controller? 
 +A Kubernetes Admission Controller is a component that intercepts requests to the Kubernetes API server before the object persistence phaseenabling you to validate or modify the object based on custom policies or business logic. 
 +    What is Kubernetes Autoscaling? 
 +Kubernetes Autoscaling refers to the process of automatically adjusting the number of Pods, nodes, or resources based on application demands or cluster utilization. This includes Horizontal Pod Autoscaler (HPA), Vertical Pod Autoscaler (VPA), and Cluster Autoscaler (CA). 
 +    What is a Kubernetes API Group?  
 +A Kubernetes API Group is a collection of related API resources that are versioned together. API groups help organize and evolve the Kubernetes API by allowing new resources or versions to be added without affecting existing resources. 
 +    What is a Kubernetes API Resource?  
 +A Kubernetes API Resource is an object that represents a part of the Kubernetes system, such as a Pod, Service, or DeploymentThese resources can be created, updated, and deleted through the Kubernetes API
 +    What is a Kubernetes API Version? 
 +A Kubernetes API Version is a specific version of the API for a group of related resourcesIt indicates the stability and support level of the API, with alpha, beta, and stable versions representing different levels of maturity
 +    What is the Kubernetes Control Loop? 
 +The Kubernetes Control Loop is the fundamental mechanism that continuously ensures the desired state of the system is maintainedControllers watch the current state and make changes as needed to achieve the desired state, such as creating, updating, or deleting resources
 +    What is kube-scheduler?  
 +Kube-scheduler is a control plane component responsible for assigning Pods to nodes based on various factorssuch as resource availability, node affinity, and taints and tolerations. 
 +    What is the Kubernetes API Server?  
 +The Kubernetes API Server is the central component of the Kubernetes control plane that exposes the Kubernetes API. It processes RESTful API requests, validates them, and updates the corresponding objects in etcd
 +    What is the Kubernetes Controller Manager? 
 +The Kubernetes Controller Manager is a control plane component that manages the core control loops, including the replication controller, endpoint controller, and namespace controller. 
 +    What is the Container Network Interface (CNI)? 
 +The Container Network Interface (CNI) is a specification and set of libraries for configuring network interfaces in Linux containers. Kubernetes uses CNI-compatible plugins to configure Pod networking
 +    What is a Kubernetes Sidecar pattern? 
 +The Kubernetes Sidecar pattern involves deploying an additional container alongside the main container within a PodThe sidecar container typically extends or enhances the functionality of the main container, such as log forwarding, monitoring, or data processing. 
 +    What is a Kubernetes Ambassador pattern? 
 +The Kubernetes Ambassador pattern involves deploying a container that acts as a proxy or adapter for the main container within a Pod. This pattern simplifies communication with external systems or provides a unified interface for accessing different services. 
 +    What is a Kubernetes Adapter pattern?  
 +The Kubernetes Adapter pattern involves deploying a container that translates or modifies the interface of the main container within a Pod. This pattern enables the main container to work with other systems or APIs without modifying its code
 +    What is the Downward API? 
 +The Downward API is a mechanism that allows Pods to expose information about themselves, such as their Pod name, namespace, and labels, as environment variables or files. 
 +    What is a Kubernetes NodeSelector? 
 +A NodeSelector is a field in a Pod specification that allows you to specify the desired characteristics of the node where the Pod should be scheduled, based on the node’s labels
 +    What is the Kubernetes Container Runtime Interface (CRI)?  
 +The Kubernetes Container Runtime Interface (CRI) is a plugin interface that allows Kubernetes to use different container runtimes, such as Docker, containerd, or CRI-O, without modifying the kubelet code
 +    What is a Kubernetes DaemonSet?  
 +A Kubernetes DaemonSet is a higher-level abstraction that ensures a specific Pod runs on all or a subset of nodes in the cluster. DaemonSets are commonly used for deploying system-level services, such as log collectors, monitoring agents, or network proxies
 +    What is a Kubernetes ConfigMap? 
 +A Kubernetes ConfigMap is an object that allows you to store non-sensitive configuration data in key-value pairs, which can be consumed by Pods as environment variables, command-line arguments, or mounted as files in a volume. 
 +    What is a Kubernetes Secret? 
 +A Kubernetes Secret is an object that allows you to store sensitive data, such as credentials, tokens, or keys, which can be consumed by Pods as environment variables or mounted as files in a volume. 
 +    What is the Kubernetes Object Management model?  
 +The Kubernetes Object Management model is a declarative approach to managing resources, where you define the desired state of the system using YAML or JSON manifests, and the control plane works to achieve and maintain that state through reconciliation loops
 +    What is the Kubernetes Garbage Collection? 
 +Kubernetes Garbage Collection is a mechanism that automatically removes unused or orphaned resources, such as terminated Pods, unused ConfigMaps, or completed Jobs, to free up system resources and maintain a clean cluster. 
 +    What is the Kubernetes Audit Log? 
 +The Kubernetes Audit Log is a record of events that occur in the Kubernetes API serverproviding detailed information about requests, responses, and metadata. It can be used for security monitoring, troubleshooting, or compliance purposes
 +    What is the Kubernetes Cloud Controller Manager? 
 +The Kubernetes Cloud Controller Manager is a control plane component that embeds cloud-specific control logic, such as managing node lifecycle, provisioning storage volumes, or configuring load balancers. It allows Kubernetes to interact with various cloud providers in a consistent and extensible way. 
 +    What is a Kubernetes ReplicaSet? 
 +A Kubernetes ReplicaSet is a higher-level abstraction that ensures a specified number of replicas of a Pod are running at any given time. It replaces the older replication controller and is used by Deployments to manage Pod scaling and updates. 
 +    What is the Kubernetes PodSecurityPolicy? 
 +A Kubernetes PodSecurityPolicy is a cluster-level resource that defines the security constraints for creating and updating Pods. It allows you to enforce best practices, such as disallowing privileged containers, restricting host access, or limiting the use of specific volume types.
  
raspberry_pi_cluster/kbs.1738928327.txt.gz · Last modified: 2025/02/07 11:38 by 85.219.17.206