k8s-ops
Collective useful k8s ops features built on top of awesome kubernetes-client
Installation
Install via npm:
$ npm i k8s-ops --save
Example
const { Apis, K8SAuthType, Features, DeploymentStatusType, Transformers } = require('k8s-ops')
const { hpa: HPA, deploy: Deploy, pod: Pod } = Features
const namespace = 'kube-system'
const apis = Apis(K8SAuthType.FromKubeconfig, namespace)
const hpa = HPA(apis, 'your-hpa')
hpa.scale({ minReplicas: 5, maxReplicas: 9 })
.then(() => hpa.assertScale({ minReplicas: 5, maxReplicas: 9 }))
.then(console.log)
const deploy = Deploy(apis, 'heapster')
deploy.assertStatus(DeploymentStatusType.AsDesired)
.then(console.log)
deploy.pods(Transformers.pod.readyAt)
.then(console.log)
const pod = Pod(apis, 'your-pod-755b9c7968-r889w')
pod.terminate().then(console.log)
pod.res.get().then(console.log)