Skip to content
This repository has been archived by the owner on Aug 26, 2024. It is now read-only.

hc-sc-ocdo-bdpd/Kubernetes_Demo

Repository files navigation

Kubernetes Hello World Application

This README outlines the steps to build, run, and deploy a simple "Hello World" web application using Docker and Kubernetes.

Prerequisites

  • Docker Desktop with Kubernetes enabled
  • kubectl command-line tool (comes with Docker Desktop)

Getting Started

Build the Docker Image

Navigate to the project directory and build your Docker image:

cd path/to/your/project
docker build -t hello-kubernetes .

Run Your Docker Container Locally

Run your Docker image as a container, mapping the container's port to a port on your host:

docker run -p 4000:5000 hello-kubernetes

Access your application by navigating to http://localhost:4000 in your web browser.

Deploying to Kubernetes

Open a New Terminal Window

When deploying to Kubernetes, it's best to use a new terminal window to keep your Docker container running.

Apply Kubernetes Deployment

Deploy your application to Kubernetes using the deployment configuration:

kubectl apply -f deployment.yaml

Apply Kubernetes Service

Expose your application outside of Kubernetes using the service configuration:

kubectl apply -f service.yaml

Accessing Your Application

Since LoadBalancer might not work as expected on Docker Desktop, use port forwarding:

kubectl port-forward service/hello-kubernetes-service 8000:80

Access your application by navigating to http://localhost:8000 in your web browser.

Deleting the Deployment

When you are finished, delete the deployment:

kubectl delete deployment hello-kubernetes

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published