Master Kubernetes Basics: Deploy, Scale, and Update Apps with Simple Commands
This article introduces Kubernetes as an open‑source container orchestration platform, explains its core objects like Pods, Services, ReplicaSets, and Deployments, clarifies its relationship with Docker, and provides a step‑by‑step example covering deployment, exposure, scaling, rolling updates, and rollback using kubectl commands.
Kubernetes (k8s) is an open‑source container orchestration platform that automates the deployment, scaling, and operation of containerized applications.
Core Kubernetes Objects
Pod: a group of one or more containers that share network and storage resources and are scheduled together on a node.
Service: an abstraction that provides a stable network address and DNS name for a set of Pods, enabling load balancing and discovery.
ReplicaSet: a controller that ensures a specified number of Pod replicas are running, creating or deleting Pods as needed.
Deployment: a higher‑level controller that manages ReplicaSets and offers rolling updates and rollbacks for seamless application version changes.
Kubernetes and Docker
Kubernetes itself does not include a container runtime; it manages containers provided by runtimes such as Docker. Docker supplies the runtime, as well as tools for building, packaging, and sharing containers. Because Docker’s native orchestration is limited to basic container management, Kubernetes is used for more complex scenarios like multi‑container coordination, load balancing, and automatic scaling.
Step‑by‑Step Deployment Example
Deploy the application:
kubectl create deployment myapp --image=myapp:1.0Expose the application as a NodePort Service:
kubectl expose deployment myapp --type=NodePort --port=80Scale the deployment to three replicas: kubectl scale deployment myapp --replicas=3 Perform a rolling update to version 2.0:
kubectl set image deployment/myapp myapp=myapp:2.0Rollback the deployment if the update fails: kubectl rollout undo deployment/myapp This basic example demonstrates how to create, expose, scale, update, and roll back an application in Kubernetes; the platform also offers advanced features such as auto‑scaling, high availability, and multi‑tenant support. For more details, consult the official Kubernetes documentation.
Full-Stack DevOps & Kubernetes
Focused on sharing DevOps, Kubernetes, Linux, Docker, Istio, microservices, Spring Cloud, Python, Go, databases, Nginx, Tomcat, cloud computing, and related technologies.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
