Assumption:
- Your Machine is running atleast Windows 10 OS
- Your machine is already setup to run .net project and application
- Visual Studio is installed
- .Net SDK and .Net Runtimes is installed
How to test locally
- Open the project in visual studio
- Run the project
- Then access it using this link http://localhost:5295/WeatherForecast
How to test using docker
Preparation for using Docker and Kubernetes
-
Create an account in docker hub (https://hub.docker.com/)
-
build your own docker image docker build -t [name of your image:v1.0.0]
-
link your newly build docker image to your dockerhubimage docker tag [name-of-your-image:v1.0.0] [yourdockerhub/name-of-your-image:v1.0.0]
-
push your new docker image to your docker hub docker push [yourdockerhub/name-of-your-image:v1.0.0]
Testing Docker
- open the command line
- Run it using docker command docker run -it --rm -p 8080:80 [yourdockerhub/name-of-your-image:v1.0.0]
- Access it using this link http://localhost:8080/WeatherForecast
- docker ps, then docker stop the running image
Testing Kubernetes
Requirement: Make sure Desktop Docker is installed in your window machine (https://www.docker.com/products/docker-desktop/)
- make sure no one is using port 8080 to make this work
Check if 8080 port is in used in windows netstat -aon | findstr 8080
kill the process who use it taskkill /f /pid [id of process]
-
Replace the docker image in Deployment.yml with your Docker image [yourdockerhub/name-of-your-image:v1.0.0]
-
open command line in the root project run this command kubectl apply -f Deployment.yml
-
run this command kubectl apply -f Service.yml
-
access the api using this url http://localhost:8080/WeatherForecast