Greetings, aspiring Kubernetes enthusiasts! Today, we delve into a comprehensive, hands-on tutorial that will take you from Kubernetes novice to hands-on practitioner. With a focus on practical examples, we'll ensure you don't just understand Kubernetes but can also apply it in your projects.

Before we dive in, a quick primer on Kubernetes (often abbreviated as K8s): It's an open-source system for automating deployment, scaling, and management of containerized applications. In other words, it helps you run and scale your applications more efficiently. Now, let's get started!

Getting Started with Kubernetes
First things first: Set up a local Kubernetes cluster using Minikube. It's the official tool from the Kubernetes project for running Kubernetes locally.

Here's how you install and start Minikube:
- Install Minikube. For macOS, use Homebrew:
brew install minikube. - Start Minikube:
minikube start.

Verifying the Kubernetes Installation
Once started, verify your Kubernetes installation by getting the list of nodes. Run this command in your terminal:
kubectl get nodes
You should see your local Minikube node detailing its status, among other details.

Deploying Your First Application
Kubernetes uses YAML files to define deployments and other resources. Let's deploy a simple Node.js application using the official Kubernetes Hello World example:
- Create a new directory and navigate into it.
- Create a new file named
deployment.yamlwith the following content:

apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-world
spec:
selector:
matchLabels:
app: hello-world
replicas: 3
template:
metadata:
labels:
app: hello-world
spec:
containers:
- name: hello-world
image: gcr.io/google-samples/node-hello:1.0
This deployment specifies three replicas (instances) of the application. Now, apply the deployment with:
kubectl apply -f deployment.yaml
Verify the deployment with:




















kubectl get deployments
Watch the pods—PODs are Kubernetes' smallest and simplest units of the Kubernetes Platform—spin up with:
kubectl get pods
Using Pods & Running Commands
Pods are the smallest deployable units in Kubernetes and hold one or more containers. Let's interact with our deployed pod:
Viewing Pod logs
To view the logs of our Hello World application, use:
kubectl logs <POD_NAME>
Executing Commands in the Pod
You can run commands inside running pods using kubectl exec. For instance, to view the environment variables in the pod:
kubectl exec <POD_NAME> -- printenv
And that's a wrap! You've just taken your first steps into the Kubernetes ecosystem.
Kubernetes, like many tools, is best understood through practice. So, keep exploring, experimenting, and expanding your knowledge. Happy K8s-ing!