How to Use Kubernetes: A Practical Guide for Beginners

Kubernetes is an open-source container orchestration platform that automates deployment, scaling, and management of containerized applications. If you’re new to Kubernetes, this guide walks you through the essential commands and concepts to get your first app running.

Before diving in, ensure you have a Kubernetes cluster. For local learning, install Minikube or use a managed service like Google Kubernetes Engine (GKE). Once your cluster is ready, install the kubectl command-line tool to interact with it.

Article illustration

1. Core Concepts: Pods, Deployments, and Services

Understand these fundamental objects:

  • Pod – the smallest deployable unit, runs one or more containers.
  • Deployment – manages a set of identical pods, enables scaling and rolling updates.
  • Service – exposes pods to network traffic (e.g., via ClusterIP, NodePort, or LoadBalancer).

2. Key Commands to Manage Resources

Use kubectl for all operations:

  • kubectl get pods – list all pods.
  • kubectl create deployment my-app --image=nginx – create a deployment.
  • kubectl expose deployment my-app --type=LoadBalancer --port=80 – expose it as a service.
  • kubectl scale deployment my-app --replicas=3 – scale horizontally.
  • kubectl delete deployment my-app – remove a resource.

3. Deploy Your First Application

Follow these steps:

  • Start Minikube: minikube start
  • Create a deployment: kubectl create deployment hello-world --image=gcr.io/google-samples/hello-app:1.0
  • Expose it: kubectl expose deployment hello-world --type=NodePort --port=8080
  • Get the access URL: minikube service hello-world --url
  • Open the URL in your browser to see your app running.

4. Monitor and Troubleshoot

Stay on top of your cluster health:

  • kubectl logs <pod-name> – view container logs.
  • kubectl describe pod <pod-name> – detailed pod status.
  • kubectl get events – cluster events for debugging.

Kubernetes may feel complex at first, but mastering these basics lets you deploy, scale, and manage apps with confidence. Practice on a local cluster, then move to production-grade setups.

sarah antaboga
Author: sarah antaboga

Leave a Reply

Your email address will not be published. Required fields are marked *