Operating System: Ubuntu 22.04.4 LTS
- Create a Docker image for the React application.
- Deploy the Docker image to the Kubernetes cluster.
- Docker must be installed.
- MicroK8s is required for running Kubernetes locally.
This project uses a simple Todo List application built with React. You can find the source code for the application in the React-Todo-list repository.
-
Clone this repository:
git clone https://github.com/msm17b019/apica-devops.git
-
Navigate to the root folder of the repository:
cd apica-devops
-
Run the Docker build command to create a Docker image:
docker build . -t myapp
-
Start the MicroK8s cluster.
-
Load the above docker image to microk8s.
docker save myapp > myapp.tar microk8s ctr image import myapp.tar
-
Apply the manifest files from the microk8s directory:
microk8s kubectl apply -f microk8s/
-
Check the NodePort assigned to the todo service. Note the NodePort number listed under the "PORT(S)" column.
microk8s kubectl get svc todo
-
Open your browser and navigate to localhost:NodePort-number. Replace NodePort-number with the actual NodePort number noted from the previous step.
For example, if the NodePort-number is 31402, you would navigate to localhost:31402 in your browser.
This should open up your React Todo List application in the browser.