Kubernetes Core Concepts and Your First Local Cluster
Edited by Dev Kilaru, Senior Data Analyst. How we make our content
Introduction
Kubernetes is an open-source platform for running and managing containers across many machines. It keeps your desired state true: if a container dies it starts another, and if you ask for five copies it maintains five. This first lesson of five explains the main concepts and sets up a free local cluster so you can practice without any cloud account.
Prerequisites
- Docker installed and running
- Comfort with the command line and with containers
Step-by-Step Guide
Step 1: Learn the main building blocks
A cluster is a set of machines called nodes. The control plane decides what runs where and keeps the cluster in its desired state. A Pod is the smallest unit you run: one or more containers that share networking and storage. A Deployment manages a set of identical Pods, handling scaling and updates. A Service gives Pods a stable address and load-balances across them. Namespaces divide a cluster into separate areas.
Step 2: Understand declarative configuration
You describe what you want in YAML files and apply them, and Kubernetes works continuously to make reality match. You rarely create Pods directly; you create a Deployment and let it manage Pods. Everything you create is a resource with an apiVersion, a kind, metadata, and a spec.
Step 3: Install kind and kubectl
kind runs a Kubernetes cluster inside Docker containers, which makes it light and quick to create and delete. Install it with your package manager, and install kubectl, the command-line client for Kubernetes. minikube is a popular alternative that works similarly.
# macOS
brew install kind
# Windows
winget install Kubernetes.kindStep 4: Create a cluster and check it
One command creates a single-node cluster named kind, and kubectl is automatically pointed at it with the context kind-kind. Confirm the cluster responds and look at its node.
kind create cluster
kubectl cluster-info --context kind-kind
kubectl get nodes
kubectl get pods --all-namespacesStep 5: Learn the everyday kubectl pattern
Most work follows the same verbs: apply a file, get resources, describe one for details and events, read logs, and delete when finished. kubectl talks to whichever cluster the current context points at, so check it before running commands. Delete the practice cluster when you finish a session. Kubernetes releases a new minor version several times a year, so check the official releases page for the current supported versions.
kubectl config current-context
kubectl apply -f app.yaml
kubectl get deployments
kubectl describe pod <pod-name>
kubectl logs <pod-name>
kind delete clusterFAQs
- Do I need Kubernetes for my application?
- Not always. A single server or a managed container service is simpler for small apps. Kubernetes pays off when you run many services, need automatic scaling and self-healing, or want portability across environments.
- Why use kind or minikube instead of a cloud cluster to learn?
- They are free, fast to create and destroy, and cannot surprise you with a cloud bill. Move to a managed cluster once you understand the concepts.
Summary
Kubernetes keeps your declared state true using nodes, Pods, Deployments, and Services. Create a throwaway local cluster with kind, check it with kubectl, and learn the apply, get, describe, logs, and delete rhythm.
Comments
Log in or create a free account to join the discussion.