Deploy Your First App in Kubernetes in 10 Minutes (Step-by-Step Guide)


🚀 Deploy Your First App in Kubernetes in 10 Minutes (Step-by-Step Guide)

So you’ve heard about Kubernetes (K8s) — the cloud-native orchestrator used by Google, Netflix, and every serious tech company.

Now it’s time to get your hands dirty.

In this blog, you’ll go from zero to deployed — launching your very first web application on Kubernetes in just 10 minutes. And you’ll learn what’s really happening under the hood at each step.


🧰 What You’ll Need


🧱 Step 1: Start Your Kubernetes Cluster

If using Docker Desktop:

  • Open Docker → Enable Kubernetes in Settings → Wait for the green “Kubernetes is running” status

If using Minikube:

minikube start

Test it with:

kubectl cluster-info
kubectl get nodes

You now have a single-node Kubernetes cluster running on your machine 🎉


📦 Step 2: Choose a Simple App to Deploy

We’ll use a pre-built Docker image:

nginxdemos/hello

This is a lightweight “Hello from NGINX” app — perfect for testing.


📄 Step 3: Create Your First Deployment

A Deployment tells Kubernetes:

  • What app to run
  • How many copies (replicas)
  • Which Docker image to use

Create a file: deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: hello-deployment
spec:
  replicas: 2
  selector:
    matchLabels:
      app: hello
  template:
    metadata:
      labels:
        app: hello
    spec:
      containers:
      - name: hello-container
        image: nginxdemos/hello
        ports:
        - containerPort: 80

Apply it with:

kubectl apply -f deployment.yaml

Check if it’s running:

kubectl get pods

🌐 Step 4: Expose the App with a Service

Your pods are running — but not accessible yet.

Let’s expose them using a Service.

Create service.yaml:

apiVersion: v1
kind: Service
metadata:
  name: hello-service
spec:
  selector:
    app: hello
  ports:
  - protocol: TCP
    port: 80
    targetPort: 80
  type: NodePort

Apply it:

kubectl apply -f service.yaml

Get the port:

kubectl get svc

Look for something like:

hello-service   NodePort   <your-ip>   80:30080/TCP

Visit in your browser:

http://localhost:30080/

🎉 You just deployed your first app on Kubernetes!


⚙️ Step 5: Scale Your App

Want more replicas?

Update in YAML or run:

kubectl scale deployment hello-deployment --replicas=4
kubectl get pods

🔁 Step 6: Update Your App (Rolling Update)

Let’s simulate an update. Change the image to a new version (if available) or update text if building your own.

To update:

kubectl set image deployment/hello-deployment hello-container=nginxdemos/hello:latest

Kubernetes will roll out the update gradually with zero downtime.

Check rollout status:

kubectl rollout status deployment/hello-deployment

📦 Step 7: Clean Up

When done:

kubectl delete service hello-service
kubectl delete deployment hello-deployment

🧠 What You Just Learned (Behind the Scenes)

ConceptWhat It Did
DeploymentManages pod lifecycle, self-heals
PodSmallest runnable unit, holds your container
ServiceRoutes traffic to pods
NodePortExposes app outside the cluster
kubectlCLI to interact with your cluster
RolloutSmoothly updates your app in production

🔁 Bonus: Run Everything in One File

Create a k8s-app.yaml to include both Deployment and Service:

# deployment and service YAMLs combined here

Then:

kubectl apply -f k8s-app.yaml

🧰 What’s Next?

After you’ve deployed your first app, level up with:

TopicWhy It Matters
HelmKubernetes package manager
ArgoCDGitOps-based deployments
Ingress ControllersSmart traffic routing
Secrets/ConfigMapsManage app configs and secrets
Horizontal Pod Autoscaler (HPA)Auto-scale based on load

🏁 Final Thoughts

Kubernetes might feel complex — but once you deploy your first app, it all clicks.

You don’t need to be a K8s guru to get started.
You just need a terminal, some YAML, and 10 minutes.


Related Posts

Kubernetes RBAC cookbook: common roles (dev, SRE, read-only) safely

Kubernetes RBAC is one of those things that feels annoying until the day it saves your cluster from “oops, I deleted prod.” The tricky part isn’t what…

Read More

General Build Pipeline (CI) in Azure DevOps

Let’s walk through a general-purpose Azure DevOps build pipeline template that can be applied to most common application types (web apps, APIs, microservices, etc.) using CI/CD best…

Read More

Kubernetes Certifications in 2025: Which One Should You Choose?

Kubernetes Certifications in 2025: Which One Should You Choose? Kubernetes has become the cornerstone of modern cloud-native application deployment and orchestration. Whether you’re a beginner just diving…

Read More

Top 5 Kubernetes Tools That Will Replace Your Bash Scripts in 2025

🚀 Top 5 Kubernetes Tools That Will Replace Your Bash Scripts in 2025 For years, DevOps engineers and platform teams have relied on Bash scripts to automate…

Read More

Kubernetes Horror Stories (and What We Learned From Them)

☠️ Kubernetes Horror Stories (and What We Learned From Them) Because what doesn’t kill your cluster makes it stronger. Kubernetes is powerful — but with great power…

Read More

Why Your Kubernetes Costs Are Out of Control – and How to Fix It (2025 Guide)

💸 Why Your Kubernetes Costs Are Out of Control – and How to Fix It (2025 Guide) Kubernetes is powerful — but it isn’t cheap. While it…

Read More
guest
0 Comments
Oldest
Newest Most Voted
0
Would love your thoughts, please comment.x
()
x