Deploy Applications with Kubernetes Deployments
1. Objective
The goal was to:
- Create a Kubernetes Deployment named
nginx
. - Use the
nginx:latest
container image (tag specified). - Verify that the deployment runs successfully on the cluster.
2. Creating the Deployment
On the jump host, I used the kubectl
command-line tool to instruct the Kubernetes cluster to create a new deployment.
kubectl create deployment nginx --image=nginx:latest
Explanation:
-
kubectl create deployment nginx
→ Creates a deployment namednginx
. -
--image=nginx:latest
→ Pulls the latest version of the Nginx container image.
Output:
deployment.apps/nginx created
This message confirms that Kubernetes accepted the request and created the deployment.
3. Verifying the Deployment
To confirm that everything is running as expected, we listed the deployments:
kubectl get deployments
Result:
NAME READY UP-TO-DATE AVAILABLE AGE
nginx 1/1 1 1 31s
- READY 1/1 → One pod is running and ready.
- UP-TO-DATE 1 → The desired state matches the current state.
- AVAILABLE 1 → The pod is accessible.
This tells us that the deployment is healthy and the Nginx application is running.
4. Checking the Cluster Nodes
I also verified the Kubernetes cluster nodes to ensure the control plane was operational:
kubectl get nodes
Output:
NAME STATUS ROLES AGE VERSION
kodekloud-control-plane Ready control-plane 26m v1.27.16-1+f5da3b717fc217
The node is in the Ready state, confirming that the cluster is capable of scheduling and running workloads.
5. Conclusion
The deployment of the Nginx application was successful.
Kubernetes automatically created:
- A Deployment to manage the application.
- A ReplicaSet to maintain the desired number of pods.
- A Pod running the
nginx:latest
container.
This task demonstrates the power of Kubernetes to deploy and manage applications with just a single command.
Top comments (0)