Skip to content

bearbearyu1223/Get-Started-with-Kubernetes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Get-Started-with-Kubernetes

Tl;dr: A simple hello world example to get started with Kubernetes.

Step 0: Setup

Download Docker for Mac at https://docs.docker.com/docker-for-mac/install/. Install Docker Desktop and enable Kubernetes.

Clone the codebase from this repository.

Step 1: Run Locally

cd app
pip install -r requirements.txt
python main.py

Step 2: Create Docker Image

In the app/ directory, build the docker image with the following command

docker build -f ../docker/Dockerfile -t hello-api:latest .

To verify if image was created, run the following command:

docker image ls

Step 3: Running the Image in Docker

docker run -p 3050:3000 hello-api

Now navigate to http://localhost:3050 to see the message.

Step 4: Running in Kubernetes

What is my current context point to?

kubectl config current-context

Use kubectl to send the YAML file to Kubernetes by running the following command:

kubectl apply -f deployment.yaml

To verify the pods are running, execute the following command:

kubectl get pods

About

Get Started with Kubernetes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published