Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

k8s

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

k8s

Node.js client library for Google's Kubernetes Kubectl And API

  • 0.1.8
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
591
decreased by-9.36%
Maintainers
1
Weekly downloads
 
Created
Source

Nodejs Kubernetes client

Node.js client library for Google's Kubernetes Kubectl And API

Install:

    npm install k8s

Usage

Create client

var K8s = require('k8s')

// use kubectl

var kubectl = K8s.kubectl({
    endpoint:  'http://192.168.10.10:8080'
    , binary: '/usr/local/bin/kubectl'
})

//use restful api
var kubeapi = K8s.api({
	endpoint: 'http://192.168.10.10:8080'
	, version: 'v1'
})

kubeAPI

// method GET
kubeapi.get('namespaces/default/replicationcontrollers', function(err, data){})
// method POST
kubeapi.post('namespaces/default/replicationcontrollers', require('./rc/nginx-rc.json'), function(err, data){})
// method PUT
kubeapi.put('namespaces/default/replicationcontrollers/nginx', require('./rc/nginx-rc.json'), function(err, data){})
// method PATCH
kubeapi.patch('namespaces/default/replicationcontrollers/nginx', { apiVersion: 'v1' , spec: { replicas: 2 } }, function(err, data){})
// method DELETE
kubeapi.delete('namespaces/default/replicationcontrollers/nginx', function(err, data){})
// method GET -> watch
kubeapi.watch('watch/namespaces/default/pods', function(data){
	// message
}, function(err){
	// exit
}, [timeout])

Pods

get pod list

kubectl.pod.list(function(err, pods){})
var label = { name: nginx }
kubectl.pod.list(label, function(err, pods){})

get pod

kubectl.pod.get('nginx', function(err, pod){})

// label selector
kubectl.pod.list({ app: 'nginx' }, function(err, pods){}) 

create a pod

kubectl.pod.create('/:path/pods/nginx.yaml'), function(err, data){})

delete a pod

kubectl.pod.delete('nginx', function(err, data){})

ReplicationController

get rc list

kubectl.rc.list(function(err, pods){})

get a rc

kubectl.rc.get('nginx', function(err, pod){})

create a rc

kubectl.rc.create('/:path/pods/nginx.yaml'), function(err, data){})

delete a rc

kubectl.rc.delete('nginx', function(err, data){})

rolling-update by image name

kubectl.rc.rollingUpdate('nginx', 'nginx:vserion', function(err, data){})

rolling-update by file

kubectl.rc.rollingUpdateByFile('nginx', '/:path/rc/nginx-v2.yaml', function(err, data){})

change replicas

kubectl.rc.scale('nginx', 3, function(err, data){})

Service

get service list

kubectl.service.list(function(err, pods){})

get a service

kubectl.service.get('nginx', function(err, pod){})

create a service

kubectl.service.create('/:path/service/nginx.yaml'), function(err, data){})

delete a service

kubectl.service.delete('nginx', function(err, data){})

Node

get node list

kubectl.node.list(function(err, pods){})

get a node

kubectl.node.get('nginx', function(err, pod){})

create a node

kubectl.node.create('/:path/nodes/node1.yaml'), function(err, data){})

delete a node

kubectl.node.delete('nginx', function(err, data){})

FAQs

Package last updated on 27 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc