@containership/kubernetes.client
[![Build Status](https://travis-ci.org/containership/kubernetes.client.svg?branch=master)](https://travis-ci.org/containership/kubernetes.client)
Last updated 10 months ago by nicktate .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @containership/kubernetes.client 
SYNC missed versions from official npm registry.

kubernetes.client

Build Status

kubernetes.client is an opinionated javascript client for Kubernetes clusters.

Warning: This project is currently under active development and is subject to breaking changes without notice.

Installing

Install with yarn:

yarn add @containership/kubernetes.client

Install with npm:

npm install @containership/kubernetes.client --save

Usage

Setting up the client

You can pull remote cluster information from an existing kubeconfig file:

const client = new KubernetesClient({
    config: KubernetesClient.Config.fromKubeConfig({
        kubeConfig: ~/.kube/config,
        context: 'my-context',
    }),
    version: '1.10'
});

If you know the version of Kubernetes the cluster is running, you can specify it when setting up the client. If not, you can always dynamically load the cluster API spec (this is preferred).

After setting up a initial client config, run the following command:

await client.loadSpec()

Once you have loaded the cluster specification either dynamically or from specifying an initial Kubernetes version, you have access to all the resources from the client.resources object.

For example, to list all the Deployments on the cluster in the default namespace, just run the following:

const deployments = await client.resources.Deployment.list()

You can specify a specific namespace and many other configurable parameters through the builder API.

const customNamespaceDeployments = await client.resources.Deployment.namespace('custom').list()

The client even supports pagination out of the box. You just pass a configured resource call to the paginate method, and it handles fetching and combining all the resources into a single list response!

const allDeployments = await KubernetesClient.paginate(client.resources.Deployment.allNamespaces().limit(25))

Extensive usage documentation and examples will become available as the project matures.

Contributing

Thank you for your interest in this project and for your interest in contributing! Feel free to open issues for feature requests, bugs, or even just questions - we love feedback and want to hear from you.

PRs are also always welcome! However, if the feature you're considering adding is fairly large in scope, please consider opening an issue for discussion first.

Inspiration

https://github.com/godaddy/kubernetes-client

We loved the way the kubernetes-client automatically generated user friendly APIs from cluster OpenAPI specs. With all this additional knowledge, we didn't think end users should have to understand which API version of resources they need to deal with to communicate with a cluster. We flipped the concept and provide a powerful way to interact with clusters without having to specify API versions, but still expose that flexibility to you if needed.

Current Tags

  • 0.6.3                                ...           latest (10 months ago)

14 Versions

  • 0.6.3                                ...           10 months ago
  • 0.6.2                                ...           a year ago
  • 0.6.1                                ...           a year ago
  • 0.6.0                                ...           a year ago
  • 0.5.0                                ...           a year ago
  • 0.4.0                                ...           a year ago
  • 0.3.2                                ...           2 years ago
  • 0.3.1                                ...           2 years ago
  • 0.3.0                                ...           2 years ago
  • 0.2.1                                ...           2 years ago
  • 0.2.0                                ...           2 years ago
  • 0.1.2                                ...           2 years ago
  • 0.1.1                                ...           2 years ago
  • 0.1.0                                ...           2 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 17
Dependencies (4)
Dev Dependencies (3)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |