Kubernetes for Beginners: Core Concepts and Your First Deployment

A beginner-friendly introduction to Kubernetes core concepts, with a working deployment and service manifest.

What Kubernetes Actually Does

Kubernetes orchestrates containers across a cluster of machines — restarting failed containers, scaling replicas up and down, and routing traffic to healthy instances. It’s overkill for a single small app, but essential once you’re running many services that need to scale independently.

Core Concepts

  • Pod — the smallest deployable unit, usually one container.
  • Deployment — manages a set of identical pod replicas and handles rolling updates.
  • Service — a stable network endpoint routing traffic to a set of pods.
  • Namespace — a way to logically separate resources within a cluster.

Your First Deployment

# deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: api-server
spec:
  replicas: 3
  selector:
    matchLabels:
      app: api-server
  template:
    metadata:
      labels:
        app: api-server
    spec:
      containers:
        - name: api-server
          image: myregistry/api-server:1.4.0
          ports:
            - containerPort: 8080
          resources:
            requests:
              cpu: "250m"
              memory: "256Mi"
            limits:
              cpu: "500m"
              memory: "512Mi"
# service.yaml
apiVersion: v1
kind: Service
metadata:
  name: api-server-service
spec:
  selector:
    app: api-server
  ports:
    - port: 80
      targetPort: 8080
  type: ClusterIP

Applying Your Manifests

kubectl apply -f deployment.yaml
kubectl apply -f service.yaml
kubectl get pods
kubectl get svc

Health Checks Matter

Without liveness and readiness probes, Kubernetes can’t tell if your app is actually healthy — it’ll route traffic to a pod that’s up but not ready:

livenessProbe:
  httpGet:
    path: /healthz
    port: 8080
  initialDelaySeconds: 10
  periodSeconds: 15
readinessProbe:
  httpGet:
    path: /ready
    port: 8080
  initialDelaySeconds: 5

Common Beginner Mistakes

  • Skipping resource requests/limits, leading to noisy-neighbor problems on shared nodes
  • Not setting readiness probes, causing traffic to hit pods that aren’t ready yet
  • Storing secrets directly in manifests instead of using Secret objects

Conclusion

Kubernetes has a real learning curve, but the core mental model — declare desired state, let the control loop reconcile it — pays off once you’re managing more than a handful of services. Start with deployments and services, add health checks immediately, and layer in more advanced primitives (HPA, ingress, config maps) as real needs arise.