Kubernetes Demystified: Kubectl & YAML Configuration
Part 2, we covered the architecture - Control Plane and Worker Nodes. Now let's look at how you actually manage Kubernetes components: through kubectl **and **YAML configuration files . How to Manage K8s Components: There are two ways to interact with your cluster's components. kubectl — the Kubernetes CLI(Imperative): A very powerful tool that enables direct interaction with the cluster. kubectl…
Managing Kubernetes components can be done in two ways: using the kubectl command-line interface (CLI) or through YAML configuration files. Kubectl is a powerful tool that allows direct interaction with the cluster, enabling operations like creating, deleting, and inspecting objects. However, it can become unwieldy when dealing with multiple Pods or components simultaneously.
Kubernetes manifests, on the other hand, are more suitable for complex scenarios. These are configuration files written in YAML format that define the desired state of the components. To apply or update a configuration, you use the kubectl apply command with the YAML file. To delete a component, you delete the YAML file.
Kubernetes configuration files are composed of three main parts: metadata specifications, specifications (spec), and status. The metadata part includes information such as the object name and labels. The spec part defines the desired configuration for the object, which varies depending on the object type. For example, a Deployment's spec looks different from a Service's spec. The status part is automatically generated by Kubernetes and contains the current state of the object.
Kubernetes constantly monitors the state of the components, comparing the desired state (specified in the YAML file) with the actual state. If they match, everything is fine. If they don't, Kubernetes automatically works to bring the actual state back in line with the desired state, a process known as self-healing. This status information is stored in etcd, a distributed key-value store that holds the current state of every Kubernetes component.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.