kubed
v0.0.3
Published
Low-level request wrapper for Kubernetes API
Downloads
6
Readme
Kubed
Simple Kubernetes API Client
This small module wraps request with enough to make lower-level Kubernetes API request. It does not attempt to cover all of the API endpoints covered in the API definition because it's changing too quickly for me to personally maintain it up to date. It does provide a sane starting point for anyone wanting to make calls from to the API from node through the proxy or from within a container.
Warning
Unstable work in progress. Currently designing, documenting and testing. This will probably not work for you yet.
Usage
npm i kubed
Defaults
If no options are passed, this will default to using the kubectl proxy's default values (ie: localhost:8080). If the environment variables: KUBERNETES_SERVICE_HOST
and KUBERNETES_PORT_443_TCP_PORT
are set, it is assumed that you are running within a Kubernetes-deployed container and defaults are changed accordingly.
const Kubed = require('kubed');
const client = new Kubed();
// client.get...
With Options
If no options are passd, this will default to using the kubectl proxy's default values (ie: localhost:8080). If the environment variables: KUBERNETES_SERVICE_HOST
and KUBERNETES_PORT_443_TCP_PORT
are set, it is assumed that you are running within a Kubernetes-deployed container and defaults are changed accordingly.
const Kubed = require('kubed');
const client = new Kubed({
baseUrl: 'https://localhost:8080',
});
// or...
const client = new Kubed({
token: `/path/to/token`,
ca: `/path/to/ca.crt`,
});
// client.get...
Contributing
- Fork the repo.
npm i
npm start
to work on the library. This runs the tests continuously watching for changes but without test output (debug output instead).- Make your changes
npm t
to run the tests with no debug output (tap output instead).npm run cov
to run coverage report.npm run linter
to run eslint.- Submit a PR.