Your First Deployment: Hello World
Key Takeaways for AI & Readers
- Deployment Object: Creating a deployment triggers a chain reaction: Deployment -> ReplicaSet -> Pod.
- Service Exposure: Pods are isolated by default; a Service (e.g., NodePort) is required to expose them to traffic.
- Observability: Standard commands like
get,describe, andlogsare essential for verifying the state of your application.
Enough theory—let's deploy an application. We will use kubectl to create a Deployment and expose it to the network.
1. Interactive Terminal Simulation
Follow the steps below to see the standard workflow for launching a containerized app.
bash — 80x24
$ kubectl get pods
No resources found in default namespace.
_
2. What just happened?
kubectl create deployment
This command didn't just start a container. It created a Deployment object in the API Server. The Controller Manager then noticed the new object and created a ReplicaSet, which finally created the Pod.
kubectl expose
By default, Pods are isolated. To allow traffic to reach them, we created a Service. In this case, we used Type: NodePort, which opens a specific port on the physical node's IP address.
3. Verification Commands
kubectl get all: See everything you just created.kubectl describe pod <name>: Deep dive into the container status and events.kubectl logs <name>: Read the output from the application.