Kubernetes Setup On Ubuntu 22.04

Deploy Your First Kubernetes Workload

Learn how to deploy a simple application on your Kubernetes cluster.

2 min read

πŸš€ Step 5: Deploy Your First Kubernetes Workload

Now that your cluster is ready with networking, let’s deploy a simple app to test it.


πŸ§ͺ Deploy a Nginx Web Server

Run the following command on your control plane node (cp-node-1):

bash

This creates a deployment named nginx running the official Nginx container image.


πŸ•΅οΈβ€β™‚οΈ Check Deployment Status

Verify the deployment and pods are running:

bash

You should see the nginx deployment with one pod in Running status.


🌐 Expose the Deployment

To access the Nginx server, expose it as a service:

bash

This exposes the deployment on a random port on all nodes.


πŸ” Find the NodePort

Get the service details to find the port assigned:

bash

Look for the NodePort value under the PORT(S) column (e.g., 80:31234/TCP).


🌍 Access the Nginx Server

Open your browser and navigate to:

bash

Replace <node-ip> with your node's IP and <node-port> with the port from the previous step.

You should see the Nginx welcome page.


βœ… Clean Up (Optional)

To delete the deployment and service:

bash

⏭ Next Steps

  • Learn about scaling deployments
  • Set up Persistent Volumes and Storage
  • Explore advanced networking options

πŸ‘‰ Continue to Page 6: Scale Your Deployments β†’