Skip to content

Latest commit

 

History

History
 
 

kubernetes

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

NestCloud - Kubernetes

NPM Version Package License NPM Downloads Travis Linux Coverage

Description

The kubernetes client module for nestcloud.

中文文档

Installation

$ npm install --save @nestcloud/kubernetes

Usage

Use External Cluster

import { Module } from '@nestjs/common';
import { KubernetesModule } from '@nestcloud/kubernetes';

@Module({
  imports: [
      KubernetesModule.register({kubeConfig: '/root/.kube/config'})
  ],
})
export class ApplicationModule {}

Use Internal Cluster

import { Module } from '@nestjs/common';
import { KubernetesModule } from '@nestcloud/kubernetes';

@Module({
  imports: [
      KubernetesModule.register()
  ],
})
export class ApplicationModule {}

Use Client

import { Injectable, IKubernetes } from '@nestjs/common';
import { InjectKubernetes } from '@nestcloud/kubernetes';

@Injectable()
export class TestService {
  constructor(@InjectKubernetes() private readonly client: IKubernetes) {}

  async getConfigMaps() {
      const result = await this.client.api.v1.namespaces('default').configmaps('test-configmap').get();
      console.log(result);
  }
}

Stay in touch

License

NestCloud is MIT licensed.