https://github.com/stuartleeks/virtual-kubelet-web-mock-nodejs
Mock API for the Virtual Kubelet web provider written in Node.js
https://github.com/stuartleeks/virtual-kubelet-web-mock-nodejs
Last synced: about 1 year ago
JSON representation
Mock API for the Virtual Kubelet web provider written in Node.js
- Host: GitHub
- URL: https://github.com/stuartleeks/virtual-kubelet-web-mock-nodejs
- Owner: stuartleeks
- License: mit
- Created: 2018-09-04T13:44:44.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-09-06T19:18:15.000Z (over 7 years ago)
- Last Synced: 2025-02-17T10:49:08.694Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Virtual Kubelet Web Provider Node JS Mock Implementation
This project is a sample API implementation for the [Virtual Kubelet](https://github.com/virtual-kubelet/virtual-kubelet) [web provider](https://github.com/virtual-kubelet/virtual-kubelet/tree/master/providers/web) written in Node.js
This API simply stores the a list of the pods that it has been requested to create, marks them as started and serves up their status
```
+----------------+ +---------------------------+ +------------------------------+
| | | | HTTP | |
| Kubernetes | <-----> | Virtual Kubelet: Web | <------> | This sample/mock API |
| | | | | |
+----------------+ +---------------------------+ +------------------------------+
```
## Running locally for development
To run the API locally, run `npm start` (or `npm run dev` to set up nodemon to monitor file changes and automatically restart the site)
To set the NodeAddress that the API returns, specify the `VKUBELET_POD_IP` environment variable.
## Connecting the API with Virtual Kubelet locally
To connect Virtual Kubelet to the API, set the `WEB_ENDPOINT_URL` environment variable to `http://localhost:3000/` (or whatever you have exposed the API as)
```bash
export WEB_ENDPOINT_URL=http://localhost:3000/
```
Then run `virtual-kubelet` with the `--provider web` switch. This will run Virtual Kubelet on your local machine. It will connect to Kubernetes based on the kubectl config, and connect to the API defined in the `WEB_ENDPOINT_URL` environment variable
## Visualising the API state
You can use `kubectl` commands to query running pods, but you can also run [Virtual Kubelet Web UI](https://github.com/stuartleeks/virtual-kubelet-web-ui) to connect to the API directly and show details of the running pods and their status.