Skip to main content

Kubernetes Deployment Guide

Deploy and manage applications with Kubernetes.

Cover image for: Kubernetes Deployment Guide

Kubernetes Deployment Guide

Master Kubernetes deployments.

Key Concepts

  • Pods: Smallest deployable units
  • Deployments: Manage replicas and updates
  • Services: Expose applications
  • Ingress: HTTP(S) routing

Deployment YAML

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

Service YAML

apiVersion: v1
kind: Service
metadata:
  name: my-app-service
spec:
  selector:
    app: my-app
  ports:
  - port: 80
    targetPort: 3000
  type: LoadBalancer

Commands

# Apply configuration
kubectl apply -f deployment.yaml

# Get pods
kubectl get pods

# Scale deployment
kubectl scale deployment my-app --replicas=5

Conclusion

Kubernetes provides powerful orchestration for containerized applications.

Share this article :