Kubernetes for Developers: A Practical Guide from Docker to K8s
Kubernetes isn't just for Ops teams. Learn the essentials of container orchestration to deploy, scale, and manage your applications with confidence.
Introduction
"It works on my machine" is a phrase every developer dreads. Docker solved this by packaging apps into containers. But what happens when you have hundreds of containers? How do you manage them, scale them, and ensure they are always running?
That's where Kubernetes (K8s) comes in. It's the operating system for the cloud. In 2025, understanding K8s primitives is as essential as knowing Git.
π‘ Why This Matters: K8s gives you the power to define your infrastructure as code, ensuring your production environment matches your design perfectly.
Before K8s: Docker
Everything in K8s starts with a container image. Here is a standard Dockerfile for a Spring Boot application.
FROM eclipse-temurin:17-jdk-alpine AS build
WORKDIR /workspace/app
COPY mvnw .
COPY .mvn .mvn
COPY pom.xml .
COPY src src
RUN ./mvnw install -DskipTests
RUN mkdir -p target/dependency && (cd target/dependency; jar -xf ../*.jar)
FROM eclipse-temurin:17-jre-alpine
VOLUME /tmp
ARG DEPENDENCY=/workspace/app/target/dependency
COPY --from=build ${DEPENDENCY}/BOOT-INF/lib /app/lib
COPY --from=build ${DEPENDENCY}/META-INF /app/META-INF
COPY --from=build ${DEPENDENCY}/BOOT-INF/classes /app
ENTRYPOINT ["java","-cp","app:app/lib/*","com.example.DemoApplication"]Core Concepts
Deployment Manifest
This YAML file tells Kubernetes how to run your Spring Boot application. It defines the number of replicas, resource limits, and environment variables.
apiVersion: apps/v1
kind: Deployment
metadata:
name: spring-boot-app
spec:
replicas: 3
selector:
matchLabels:
app: spring-boot-app
template:
metadata:
labels:
app: spring-boot-app
spec:
containers:
- name: spring-boot-app
image: my-registry/spring-boot-app:v1
ports:
- containerPort: 8080
resources:
requests:
memory: "256Mi"
cpu: "250m"
limits:
memory: "512Mi"
cpu: "500m"
env:
- name: SPRING_PROFILES_ACTIVE
value: "prod"
livenessProbe:
httpGet:
path: /actuator/health
port: 8080
initialDelaySeconds: 30
periodSeconds: 10Security Considerations
Kubernetes is secure by design, but configuration matters.
π RBAC
Use Role-Based Access Control to limit who can do what in the cluster.
π Secrets
Never store passwords in plain text. Use K8s Secrets or Vault.
π Network Policies
Restrict traffic between Pods. Only allow necessary communication.
π Image Scanning
Scan Docker images for vulnerabilities before deployment.
β Deployment Checklist
Ready to push to prod?
Validate Your Config
Use our tools to validate JSON and YAML configurations before applying them.
Related Topics
Conclusion
Kubernetes is a steep learning curve, but the payoff is immense. It provides a standard language for deploying and managing software anywhereβon-prem, AWS, Google Cloud, or Azure.
By mastering Docker and the basic K8s objects (Pods, Deployments, Services), you unlock the ability to build truly cloud-native, resilient applications.