/nodejs-k8s

Attempt to recreate the core functionality of v1.29.1 Kubernetes in NodeJS, whle being fully compatible with the kubectl CLI

Primary LanguageJavaScriptMIT LicenseMIT

Kubernetes in NodeJS

This project was/is an attempt to recreate the core functionality of v1.29.1 Kubernetes in NodeJS, while being fully compatible with the kubectl CLI. Though this project only implements some resources, the resources which were partially/fully implemented seem to be the most used (i.e. Pods, Services, etc) and the others may be implemented in the future.

Resources Partially Implemented

  • Pod (volume mounts are not supported)
  • ClusterRole
  • ClusterRoleBinding
  • Ingress
  • Role
  • RoleBinding
  • Endpoints (untested)
  • CertificateSigningRequest

Resources Fully Implemented

  • ConfigMap
  • Secret
  • Deployment
  • Namespace
  • Service

Requirements

It is also recommended you install kubectl, though it is not required

How to use

  1. Install NodeJS and Docker
  2. Install the project dependencies by running npm i
  3. If you have your own MongDB instance, create a .env file and set DB_URL to your MongoDB instance. If you do not have a MongoDB instance, a MongoDB instance will be spun up with Docker for you when you run the project (in the next step).
  4. Run npm start (you may need to allow the start script to run by modifying the permissions of start.sh (with chmod)
  5. Set your kubectl to use this project by running kubectl config use-context /localhost:8080/admin in your shell
  6. Create Kubernetes resources with kubectl

Upon running the project you can use the examples in examples/helloworld or your own YAML to create resources.

Feel free to open an issue and/or make a PR if something is broken.

Licensed under the MIT License, full license is available in LICENSE.md