0.7.5 • Published 4 years ago
@nestcfork/kubernetes v0.7.5
NestCloud - Kubernetes
Description
The kubernetes client module for nestcloud.
Installation
$ npm install --save @nestcfork/kubernetes
Usage
Use External Cluster
import { Module } from '@nestjs/common';
import { KubernetesModule } from '@nestcfork/kubernetes';
@Module({
imports: [
KubernetesModule.forRoot({ kubeConfig: '/root/.kube/config' })
],
})
export class AppModule {
}
Use Internal Cluster
import { Module } from '@nestjs/common';
import { KubernetesModule } from '@nestcfork/kubernetes';
@Module({
imports: [
KubernetesModule.forRoot()
],
})
export class AppModule {}
Use Client
import { Injectable, IKubernetes } from '@nestjs/common';
import { InjectKubernetes } from '@nestcfork/kubernetes';
@Injectable()
export class TestService {
constructor(
@InjectKubernetes() private readonly client: IKubernetes,
) {
}
async getConfigMaps() {
const namespace = 'default';
const configMap = 'test-configmap';
const result = await this.client.api.v1.namespaces(namespace).configmaps(configMap).get();
console.log(result);
}
}
Stay in touch
- Author - NestCloud
License
NestCloud is MIT licensed.
0.7.5
4 years ago