Beginners Guide To Kubernetes

Beginners Guide To Kubernetes

Reading time1 min
#Cloud#DevOps#Containers#Kubernetes#Minikube#Deployment

Mastering Kubernetes Basics: Deploy Your First App with Confidence

Forget drowning in jargon and theory—let's take a sharp, no-nonsense dive into real deployment steps that beginners can execute today. This guide flips the narrative from overwhelming to actionable, proving Kubernetes isn't just for seasoned ops teams.


Kubernetes might seem like an intimidating beast at first glance. Its buzzworthy reputation as the "container orchestration king" often scares off beginners who feel engulfed by endless terminology and complexity. But here’s the truth: mastering Kubernetes basics is far more accessible than you think—especially when you focus on practical steps instead of theoretical overload.

In this post, I’ll walk you through deploying your very first application on Kubernetes, hands-on and straightforward. By the end, you’ll have a functioning app running inside a Kubernetes cluster and understand fundamental concepts without stress.


What You Need Before Starting

To follow along smoothly, make sure you have:

  • A working Kubernetes cluster: You can create a local one with Minikube or use managed services like Google Kubernetes Engine (GKE) or Azure AKS.
  • kubectl installed: This command-line tool interacts with your cluster. Installation Guide
  • A terminal or command prompt to execute commands.
  • Basic familiarity with Docker containers (helpful but not mandatory).

Step 1: Understand the Core Concepts

Before jumping into commands, here’s a quick rundown of core components you’ll interact with:

  • Pod: The smallest deployable unit; think of it as one or more containers running together.
  • Deployment: Defines how many replicas of your Pod should run, letting Kubernetes maintain your desired state.
  • Service: Exposes your Pods and provides networking so users/apps can reach them.

Think of Deployment as the manager, Pod as the worker(s), and Service as the receptionist forwarding requests.


Step 2: Choose Your First App

Let’s keep it simple—deploying an NGINX web server. NGINX is lightweight and perfect to demonstrate basic deployment.


Step 3: Create a Deployment Configuration File

We’ll use YAML to describe our Deployment. Create a file named nginx-deployment.yaml with this content:

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

Breakdown:

  • replicas: 2 means we want two instances of this Pod running.
  • The container uses the official nginx image.
  • Port 80 inside the container will serve our web pages.

Step 4: Deploy it!

Run this command in your terminal:

kubectl apply -f nginx-deployment.yaml

You should see output like:

deployment.apps/nginx-deployment created

To verify Pods are running:

kubectl get pods

Output example:

NAME                               READY   STATUS    RESTARTS   AGE
nginx-deployment-5c6f8f7b7d-rx9lz 1/1     Running   0          30s
nginx-deployment-5c6f8f7b7d-vh2dz 1/1     Running   0          30s

Awesome! Your app is live inside Pods.


Step 5: Expose Your Deployment via a Service

The Pods are running but not accessible from outside yet. We'll create a Service to expose our NGINX app on port 80 of your localhost (when using Minikube) or an external IP (on managed clusters).

Run this command to expose it as a NodePort service:

kubectl expose deployment/nginx-deployment --type=NodePort --port=80

Check the service and note the port assigned:

kubectl get service/nginx-deployment

Example output:

NAME               TYPE       CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
nginx-deployment   NodePort   10.96.120.240    <none>        80:31234/TCP     1m

Here 31234 is the NodePort assigned randomly within the range (30000–32767).


Step 6: Access Your App

If using Minikube:

Get Minikube IP with:

minikube ip

Then open your browser at:

http://<minikube-ip>:<node-port>

Example (if minikube IP is 192.168.99.100):

http://192.168.99.100:31234

You should see the default NGINX welcome page!

If using cloud managed cluster:

You would typically configure LoadBalancer services or ingress – but for now, focus on accessing via NodePort through your nodes' external IP addresses.


Step 7 (Optional): Scale Your Deployment Up/Down

Need more or fewer instances? Run:

kubectl scale deployment/nginx-deployment --replicas=4

Check Pods again with kubectl get pods. Kubernetes spins up new Pods automatically!


Troubleshooting Tips

  • If Pods are stuck in ContainerCreating or CrashLoopBackOff, check Pod logs:
kubectl logs <pod-name>
  • Confirm your Kubernetes context points to your desired cluster:
kubectl config current-context

Wrapping Up – What Did You Learn?

  • How to define and deploy an app declaratively using YAML.
  • How Deployments manage multiple replicas for availability.
  • Using Services to expose Pods for external access.
  • Scaling apps dynamically with simple commands.

This foundational workflow empowers you beyond toy examples—it’s the same pattern used by countless organizations worldwide managing highly complex production workloads!


What's Next?

Once comfortable with these steps, explore additional concepts like Persistent Volumes for storage, ConfigMaps for configuration management, Ingress controllers for routing traffic better, and deploying your own custom apps beyond NGINX!

Remember — Kubernetes is intimidating only when approached as theory-first. Focus on doing first; understanding will follow naturally.

Happy deploying!


Enjoyed this hands-on beginner’s guide? Subscribe for more clear-cut cloud native tutorials right here!

#Kubernetes #DevOps #CloudNative #BeginnersGuide #ContainerOrchestration