
Complete Guide to Kubernetes: Container Orchestration for Scalable Applications
Kubernetes has become the leading platform for container orchestration and management in the application infrastructure world. Through this blog, I will explain a journey through the most commonly used Kubernetes concepts, from the most basic to the most complex use cases with examples and key commands to use.
Introduction to Kubernetes
Kubernetes, also known as K8s, is an open-source platform that automates the deployment, scaling, and operation of containerized applications. Containers are units that encapsulate an application and all its dependencies. Kubernetes provides tools to efficiently manage containers, ensuring high availability and scalability of applications.
Installation and Configuration
The installation of Kubernetes can vary depending on the platform, but there are some tools like ‘kubeadm’, ‘minikube’ or cloud solutions such as:
- Google Kubernetes Engine (GKE) ⇨ Google Cloud Platform (GCP) cloud.
- Elastic Kubernetes Services (EKS) ⇨ Amazon Web Service (AWS) cloud.
- Azure Kubernetes Services (AKS) ⇨ Azure cloud (Azure).
Once installed, you can configure your command-line tools to access the cluster.
Example of installation using the ‘minikube’ tool
# Installation of minikube (Linux)
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
chmod +x minikube-linux-amd64
sudo mv minikube-linux-amd64 /usr/local/bin/minikube
# Start minikube cluster
minikube start
💡 Note: Before starting and seeing what the different components used in Kubernetes are, several things must be clear: first, the indentation in Yaml files, without which errors will occur, and second ALWAYS, but ALWAYS a Yaml file is built with four (4) indispensable levels for creating a Yaml file, in this order respectively, which are:
- apiVersion
- kind
- metadata
- spec
Where:

Having explained the above, we can see each of the components contained in this orchestration tool called Kubernetes.
Pods and Containers
A Pod is the most basic deployment unit in Kubernetes. It can contain one or more containers that share resources and network.
Let's see an example of how to create a Pod through a Yml file.
# pod-example.yaml
apiVersion: v1
kind: Pod
metadata:
name: my-pod
spec:
containers:
- name: my-container
image: nginx:latest
💡Note: In the previous example, we see a Yaml file called ‘pod-example.yaml’, the first step would be to create the pod, secondly list the pods to see if our pod was created successfully, and if we want to delve deeper into our Pod we can use the reserved word ‘describe’, the commands would be in this order and in this way:
# Create the Pod
kubectl apply -f pod-example.yaml
# List Pods
kubectl get pods
# Get detailed information about a Pod
kubectl describe pod my-pod
Replication and Scaling
Kubernetes allows replicating and scaling applications easily through a Yaml file or declaratively (terminal), to improve availability and performance.
Let's see an example of how to create a ReplicaSet through a Yml file.
# replicaset-example.yaml
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: my-replicaset
spec:
replicas: 3
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: my-container
image: nginx:latest
💡 Note: In the previous example, we see a Yaml file called ‘replicaset-example.yaml’, the first step would be to create the replicaset, secondly list the replicasets to see if our replica was created successfully, and if we want to scale our replica without having to enter our Yml file, the commands would be in this order and in this way:
# Create ReplicaSet
kubectl apply -f replicaset-example.yaml
# List ReplicaSets
kubectl get replicasets
# Scale ReplicaSet
kubectl scale replicaset my-replicaset --replicas=5
Services and Networking
Services allow communication between different sets of Containers in Kubernetes. A Service can be exposed internally or externally.
Let's see an example of how to create a Service through a Yml file.
# service-example.yaml
apiVersion: v1
kind: Service
metadata:
name: my-service
spec:
selector:
app: my-app
ports:
- protocol: TCP
port: 80
targetPort: 80
type: ClusterIP
💡Note: In the previous example, we see a Yaml file called ‘service-example.yaml’, the first step would be to create the service, secondly list the services to verify if it was created successfully’, the commands would be in this order and in this way:
# Create Service
kubectl apply -f service-example.yaml
# List Services
kubectl get services
Configuration and Secrets
Secrets in Kubernetes allow storing sensitive information, such as passwords, securely.
Let's see an example of how to create a Secret through a Yml file.
# secret-example.yaml
apiVersion: v1
kind: Secret
metadata:
name: my-secret
type: Opaque
data:
username: YWRtaW4= # Base64-encoded "admin"
password: cGFzc3dvcmQ= # Base64-encoded "password"
💡Note: In the previous example, we see a Yaml file called ‘secret-example.yaml’, the first step would be to create the secret, secondly list the secrets to verify if it was created successfully’, the commands would be in this order and in this way:
# Create Secret
kubectl apply -f secret-example.yaml
# List Secrets
kubectl get secrets
Monitoring
Observability is fundamental in Kubernetes, as it helps teams identify problems and proactively manage Kubernetes clusters. Tools like Prometheus can be used.
Example of installation using the ‘Prometheus’ tool
# Install Prometheus using Helm
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm install prometheus prometheus-community/prometheus
# Access Prometheus web interface
kubectl port-forward svc/prometheus-server 9090:80
Deployments
A Deployment is an object that can represent an application in the cluster. When creating the Deployment, you can specify in the spec of the Deployment how many replicas of the application you want to run.
Let's see an example of how to create a Deployment through a Yml file.
# deployment-example.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp-deployment
labels:
app: myapp
type: front-end
spec:
template:
metadata:
name: myapp-pod
labels:
app: my-app
type: front-end
spec:
containers:
- name: my-container
image: nginx:latest
replicas: 3
selector:
matchlabels:
type: front-end
💡Note: In the previous example, we see a Yaml file called ‘deployment-example.yaml’, the first step would be to create the deployment, secondly list the secrets to verify if it was created successfully’, the commands would be in this order and as follows:
# Create Deployment
kubectl create -f deployment-example.yaml
# List Deployments
kubectl get deployments
# List replicasets
kubectl get replicaset
# List Pods
kubectl get pods
Updates and Rollbacks
Rolling Updates allow you to update applications gradually to avoid interruptions.
Example of updating a ‘Deployment’
# Update the container image
kubectl set image deployment/my-deployment my-container=nginx:1.21.1
# Rollback to the previous version
kubectl rollout undo deployment/my-deployment
Advanced Use Case
Kubernetes can be used in various use cases, such as multi-cluster deployments, persistent storage, batch job execution, among others.
Let's see an example of how to create a BatchJob through a Yml file.
# job-example.yaml
apiVersion: batch/v1
kind: Job
metadata:
name: my-job
spec:
template:
spec:
containers:
- name: my-container
image: busybox:1.33.1
command: ["echo", "Hello from the job!"]
restartPolicy: Never
💡Note: In the previous example, we see a Yaml file called ‘job-example.yaml’, the first step would be to create the job, secondly list the jobs to verify if it was created successfully’, the commands would be in this order and as follows:
# Create Job
kubectl apply -f job-example.yaml
# List Jobs
kubectl get jobs
Conclusion
With this, we have explored a wide range of concepts used in Kubernetes from the most basic concepts like creating a Pod to the more advanced ones. This is a very powerful tool that allows you to orchestrate applications efficiently and scalably in container environments.
Ready to optimize the management of your applications with Kubernetes?
At Kranio, we have experts in container orchestration who will help you implement efficient solutions using Kubernetes, ensuring the scalability and performance of your applications. Contact us and discover how we can drive the digital transformation of your company.
Previous Posts

Google Apps Scripts: Automation and Efficiency within the Google Ecosystem
Automate tasks, connect Google Workspace, and enhance internal processes with Google Apps Script. An efficient solution for teams and businesses.

Augmented Coding vs. Vibe Coding
AI generates functional code but does not guarantee security. Learn to use it wisely to build robust, scalable, and risk-free software.
