Hi, this repository contains the code for creating a sample MERN-type web application showing the operation of the Kubernetes cluster. Inside the k8s configuration, I used such elements as Ingress, ClusterIP, NodePort, PV, PVC. If you have no idea what I'm talking about, below in the "Links" section you will find the sources with various articles or documentation I read in process of creation.
Configuration contains:
- Client in React (js)
- API-server (runs with Node.js and Express.js)
- Database in MongoDB with cache in Redis
- YAML files to create k8s cluster
- The user views the React web app with a browser.
- The React front end communicates with the Express back end via RESTful APIs.
- The back-end Express application uses the Mongo database for storing and retrieving data.
- Back-end results are communicated back to the front end.
- Front-end results are rendered in a human-readable format to the user.
- Docker
- Kubernetes
- Mnikube
Configuration was created under Linux OS, so I don't know if it is going to work under Windows OS.
- Apply all
.yamlfiles to k8s - Check your minikube IP
- Add the following line to the bottom of the /etc/hosts file on your computer (you will need administrator access):
[minikube IP] todo-app-k8s.com- After you make this change, your web browser sends requests for todo-app-k8s.com URLs to Minikube.
Client web-app:
www.todo-app-k8s.com
API server:
www.todo-app-k8s.com/api
You will find here ready to use docker images.
- All deployments in the cluster has own NodePorts. They are not crucial for app to work and they are for development purposes.
| Deployment | PORT |
|---|---|
| Client | 30080 |
| Server | 30500 |
| MongoDB | 30270 |
| Redis | 30379 |
- Mongo, Redis, and the API server only have one pod in my setup, but the client has 3. That's because I expect the client to have the most traffic to serve. If necessary, you can always change the number of pods with the client.
- Fix Redis error
- Finish README
- Create backend documentation