kubernetes-client is
merging with
@kubernetes/client-node. kubernetes-client
will continue to be a "fluent" JavaScript bindings for the
Kubernetes API and @kubernetes/client-node will be a lower-level set of API
bindings. As part of this merging process kubernetes-client will
adopt some of the @kubernetes/client-node APIs. Those changes,
unfortunately, will cause breaking changes to the kubernetes-client
API. These breaking changes will be included in
kubernetes-client@9.0.0.
See Issue #234 and Pull Request #244 for more discussion.
You must construct your backend of choice with the config options.
// Depcrecated
const client = new Client({ config: config.fromKubeconfig(), version: '1.14' })
// New version
const client = new Client({ version: '1.14' })
// Depcrecated
const config = { /* custom config */ }
const client = new Client({ config, version: '1.14' })
// New version
const config = { /* custom config */ }
const Request = require('kubernetes-client/backends/request')
const client = new Client({ backend: new Request(config), version: '1.14' })You must access .config via the request backend.
// Depcrecated
const config = require('kubernetes-client').config
// New version
const config = require('kubernetes-client/backends/request').configYou can stream watch endpoints and Pod logs:
// Depcrecated `watch`
const events = client.api.v1.watch.namespaces(namespace).pods.getStream()
// New version `watch` (notice the `await`!)
const events = await client.api.v1.watch.namespaces(namespace).pods.getObjectStream()
// Deprecated `Pod` logs
const stream = client.api.v1.namespaces(namespace).pods(manifest.metadata.name).log.getStream()
// new version `Pod` logs (notice the `await`!)
const stream = await client.api.v1.namespaces(namespace).pods(manifest.metadata.name).log.getByteStream()We are going to remove support for streaming other endpoints.
You must construct a Request backend with a
@kubernetes/client-node KubeConfig object.
// Deprecated loading from kubeconfig file
const Request = require('kubernetes-client/backends/request')
const requestOptions = Request.config.fromKubeconfig(Request.config.loadKubeconfig())
const backend = new Request(requestOptions)
// New version of loading from kubeconfig file
const { KubeConfig } = require('kubernetes-client')
const kubeconfig = new KubeConfig()
kubeconfig.loadFromDefault()
const backend = new Request({ kubeconfig })
// Deprecated loading from in-cluster config
const requestOptions = Request.config.fromKubeconfig(Request.config.getInCluster())
const backend = new Request(requestOptions)
// New reversion of loading from in-cluster config
const kubeconfig = new KubeConfig()
kubeconfig.loadFromCluster()
const backend = new Request({ kubeconfig })Because it will improve the quality of both JavaScript clients and reduce the engineering effort required to improve and maintain them. For example, instead of maintaining multiple implementations of configuration handling, the community can focus on improving a single implementation.