What is Kubernetes?
Kubernetes (often abbreviated as K8s) is an open-source container orchestration platform that automates the deployment, scaling, and management of containerized applications. It groups containers that make up an application into logical units for easy management and discovery.
Cluster
A Kubernetes Cluster is the foundation. It's a set of machines, called nodes, that run your containerized applications. A cluster consists of a Control Plane (which manages the cluster) and one or more Nodes (which run the applications).
Node
A Node is a worker machine in the Kubernetes cluster (it can be a physical machine or a virtual machine). Each node runs essential components like the kubelet (which communicates with the control plane) and a container runtime (like Docker) to run containers.
Pod
A Pod is the smallest and simplest deployable unit in Kubernetes. A Pod represents a single instance of your application. It can contain one or more tightly coupled containers that share storage and network resources.
Deployment
A Deployment is an API object that manages a set of identical Pods. It defines how many replicas of a Pod should be running and automates updates and rollbacks, ensuring your application remains stable and available.
Service
A Service provides a stable network identity for a set of Pods. Since Pods can be created and destroyed, their IP addresses change. A Service acts as an internal load balancer, giving you a single, stable IP address and DNS name to access the application running in those Pods.
Ingress
An Ingress manages external access to the services in a cluster, typically HTTP and HTTPS. It acts as a "smart router" or entry point to your cluster. It can provide load balancing, SSL termination, and name-based virtual hosting (e.g., directing `foo.example.com` to one service and `bar.example.com` to another).
Namespace
A Namespace provides a mechanism for isolating groups of resources within a single cluster. It's like a virtual sub-cluster, allowing multiple teams or projects to share a cluster without interfering with each other's resources.
Persistent Volume (PV)
A Persistent Volume (PV) is a piece of storage in the cluster that an administrator has provisioned. Because container filesystems are temporary (deleted when a Pod restarts), a PV provides durable storage that exists independently of the Pod's lifecycle, allowing your application's data to persist.
PersistentVolumeClaim (PVC)
A PersistentVolumeClaim (PVC) is a request for storage by a user. It's like a Pod asking for a certain amount of CPU and memory. A PVC consumes PV resources, and Kubernetes binds a suitable PV to the PVC automatically.
ConfigMap
A ConfigMap is an API object used to store non-confidential data in key-value pairs. It allows you to decouple configuration artifacts from image content to keep containerized applications portable. Common uses include storing environment variables, command-line arguments, or config files.
Secret
A Secret is similar to a ConfigMap but is specifically designed to hold sensitive information, such as passwords, OAuth tokens, and SSH keys. Kubernetes encodes (Base64) these secrets to protect them from casual observation, but they are not encrypted at rest by default.
YAML File
YAML (.yaml or .yml) is a human-readable data serialization language. In Kubernetes, you don't typically use commands to create objects. Instead, you define the desired state of your application in YAML "manifest" files, and then you tell Kubernetes to make the cluster match that state.
Comparison 1: Service Types (Network Access)
| Service Type | Scope | Access Method | Use Case |
|---|---|---|---|
| ClusterIP | Cluster-Internal Only | Via Internal IP (Static) | Internal APIs, Databases |
| NodePort | Internal and External | Via Node IP:Port (on all nodes) | Demos, Testing, IoT |
| LoadBalancer | External (via Cloud) | Via Dedicated External IP | Cloud Production Sites |
Comparison 2: Controllers (Pod Management)
| Controller | Core Characteristic | Use Case | Identification |
|---|---|---|---|
| Deployment | Stateless | Web Servers, APIs, Scalable Services. | Pods have no fixed order (Pod A, Pod B...). |
| StatefulSet | Stateful | Databases (MySQL, Kafka) requiring stable ID and order. | Pods have fixed names (pod-0, pod-1...). |
| DaemonSet | Node-Level | Ensures one Pod runs on every node. | Log collectors, Monitoring agents. |