Skip to content
← Back to Blog

Kubernetes Introduction

Kubernetes (K8s) is an open-source system for automating deployment, scaling, and management of containerised applications.

Core Concepts

  • Pod — the smallest deployable unit; wraps one or more containers
  • Deployment — declares the desired state for a set of pods
  • Service — exposes a set of pods as a network endpoint
  • Namespace — a virtual cluster for isolating resources
  • ConfigMap / Secret — externalise configuration and sensitive data

Basic kubectl Commands

bash
# View all pods
kubectl get pods

# Apply a manifest
kubectl apply -f deployment.yaml

# View logs
kubectl logs <pod-name>

# Scale a deployment
kubectl scale deployment my-app --replicas=3

# Describe a resource
kubectl describe pod <pod-name>

Example Deployment

yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app
spec:
  replicas: 2
  selector:
    matchLabels:
      app: my-app
  template:
    metadata:
      labels:
        app: my-app
    spec:
      containers:
        - name: my-app
          image: my-app:latest
          ports:
            - containerPort: 3000

Last updated:

Rohit ❤️