Neglected Puppy Market


    0.6.0 • Public • Published


    Kubernetes node client that uses r2 internally for requests to take advantage of fetch and keep the library file size low when running from the browser. The k8s-fetch-client is fully compatible with async/await syntax!

    Being written to the Fetch API is a huge benefit for browser users. When running through browserify request is ~2M uncompressed and ~500K compressed. r2 is only 66K uncompressed and 16K compressed.

    See for more details about r2.

    Getting Started

    Simply create a new instance of the client and call .connect to parse the given kubernetes cluster's api.

    const k8sClient = require('k8s-fetch-client');
    const client = new k8sClient({
        host: '',
        port: '8443'
    async function start() {
        await client.connect();
        const pods = client.apis.Core.pods.get();

    How it Works

    The .connect function fetches api metadata from the given kubernetes cluster and builds up a series of convenience functions for you to use. All api groups and resources are scoped under client.apis. It determines the preferred API version for each group and then fetches additional information about each Resource in the group. It then builds a series of helpers based on the supported verbs.

    Note: Currently the client does not build child resources, e.g. deployments/status will be ignored.

    GET /apis/apps/v1beta2

          "name": "deployments",
          "singularName": "",
          "namespaced": true,
          "kind": "Deployment",
          "verbs": [
          "shortNames": [
          "categories": [

    That resource definition will result in the following convenience methods.

    verb: create -> client.apis.apps.Deployment.create(payload)
    verb: delete -> client.apis.apps.Deployment.delete(identifier)
    verb: deleteCollection -> client.apis.apps.Deployment.delete()
    verb: get -> client.apis.apps.Deployment.get(identifier)
    verb: list -> client.apis.apps.Deployment.get()
    verb: patch -> client.apis.apps.Deployment.patch(payload)
    verb: update -> client.apis.apps.Deployment.update(payload)
    verb: watch ->

    The format is always: client.apis.${}.${resource.kind}



    npm i k8s.fetch.client

    DownloadsWeekly Downloads






    Unpacked Size

    464 kB

    Total Files


    Last publish


    • containershipbot
    • mikestoltz
    • nicktate
    • normanjoyner