Master Kubernetes Basics: From Core Concepts to Your First Deployment
This guide introduces Kubernetes as an open‑source container orchestration platform, explains its core features and architecture, walks through essential concepts, environment setup, kubectl commands, YAML examples, and provides a step‑by‑step path for hands‑on learning and advanced topics.
What is Kubernetes and why use it?
Kubernetes (k8s) is an open‑source container orchestration system that automates deployment, scaling, and management of containerized applications.
Its core value lies in:
Service discovery & load balancing : automatically routes traffic to healthy containers.
Self‑healing : restarts or migrates failed containers.
Elastic scaling : expands or shrinks workloads based on load.
Storage orchestration : mounts local or cloud storage.
Configuration & secret management : secures application configs and sensitive data.
Automated rollout & rollback : smooth upgrades with automatic rollback on failure.
In short, Kubernetes solves the operational challenges of large‑scale container management.
Key concepts you must master
Think of Kubernetes as an operating system; a Pod is a “process”.
Pod – the smallest deployable unit, containing one or more containers.
Node – a server where Pods run.
Cluster – a collection of Nodes.
Deployment – manages replica count and upgrade strategy for Pods.
Service – provides a stable network endpoint, solving changing Pod IPs.
Namespace – logical isolation for resources (dev/test/prod).
ConfigMap & Secret – decouple configuration from images; Secret stores sensitive data.
Volume – external storage for persistence.
Ingress – HTTP routing rules for domain/path access.
Architecture overview
A Kubernetes cluster consists of a control plane (master) and worker nodes.
Control plane components
kube‑apiserver : API hub, entry point for all requests.
etcd : distributed key‑value store that holds cluster state.
kube‑scheduler : assigns Pods to suitable Nodes.
kube‑controller‑manager : runs various controllers (replicas, nodes, self‑healing, etc.).
Worker node components
kubelet : manages Pod lifecycle on the node.
kube‑proxy : implements Service networking and load balancing.
Container runtime (Docker, containerd, …): runs the containers.
Learning and practice steps
Set up an environment : local options include Minikube, Docker Desktop, or Kind.
Get familiar with kubectl – common commands:
kubectl get pods
kubectl describe pod <name>
kubectl apply -f xxx.yaml
kubectl delete -f xxx.yaml
kubectl logs <pod-name>
kubectl exec -it <pod-name> -- /bin/bashUnderstand YAML definitions – example Deployment:
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80and Service:
apiVersion: v1
kind: Service
metadata:
name: nginx-service
spec:
selector:
app: nginx
ports:
- protocol: TCP
port: 80
targetPort: 80
type: LoadBalancerDeploy your first app :
kubectl apply -f deployment.yaml
kubectl apply -f service.yaml
kubectl get pods
kubectl get svcIf using Minikube, expose the service with minikube service nginx-service.
Advance your knowledge – explore configuration management (ConfigMap, Secret), storage (PV/PVC), networking (Ingress controller), security (RBAC), and stateful workloads (StatefulSet).
Recommended learning resources
Official Kubernetes documentation – “Kubernetes Basics”.
Books: “Kubernetes in Action”, “深入剖析 Kubernetes” (by Zhang Lei).
Summary
Learning path: understand core concepts → set up environment → master kubectl → write YAML to deploy apps → expose services with Service/Ingress → dive into configuration, storage, networking, security → tackle advanced topics.
There are no shortcuts; hands‑on practice combined with the official docs is the fastest way to master Kubernetes.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Ray's Galactic Tech
Practice together, never alone. We cover programming languages, development tools, learning methods, and pitfall notes. We simplify complex topics, guiding you from beginner to advanced. Weekly practical content—let's grow together!
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
