Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about the setup of this example #3

Open
Sy-D opened this issue Dec 20, 2019 · 1 comment
Open

Question about the setup of this example #3

Sy-D opened this issue Dec 20, 2019 · 1 comment

Comments

@Sy-D
Copy link

Sy-D commented Dec 20, 2019

Hey guys, im trying to get my head around what is going wrong, running this project in dev mode(nodemon).

Problem:

2019-12-20 20:28:29 - info: [nestcloud-kubernetes-example] interval get service name from boot: nestcloud-kubernetes-example 2019-12-20 20:28:29 - info: [nestcloud-kubernetes-example] interval get data from k8s configMap: default custom data 2019-12-20 20:28:30 - error: [nestcloud-kubernetes-example] Unable to initial ConfigModule, retrying... message=configmaps "nestcloud-kubernetes-config" not found, stack=Error: configmaps "nestcloud-kubernetes-config" not found at /Users/simon/Documents/Development/Privat/Microservice/nestcloud-kubernetes-example-master/node_modules/kubernetes-client/backends/request/client.js:225:25 at Request._callback (/Users/simon/Documents/Development/Privat/Microservice/nestcloud-kubernetes-example-master/node_modules/kubernetes-client/backends/request/client.js:162:14) at Request.self.callback (/Users/simon/Documents/Development/Privat/Microservice/nestcloud-kubernetes-example-master/node_modules/request/request.js:185:22) at Request.emit (events.js:210:5) at Request.EventEmitter.emit (domain.js:478:20) at Request.<anonymous> (/Users/simon/Documents/Development/Privat/Microservice/nestcloud-kubernetes-example-master/node_modules/request/request.js:1161:10) at Request.emit (events.js:210:5) at Request.EventEmitter.emit (domain.js:478:20) at IncomingMessage.<anonymous> (/Users/simonsimondoba/Documents/Development/Privat/Microservice/nestcloud-kubernetes-example-master/node_modules/request/request.js:1083:12) at Object.onceWrapper (events.js:299:28) at IncomingMessage.emit (events.js:215:7) at IncomingMessage.EventEmitter.emit (domain.js:478:20) at endReadableNT (_stream_readable.js:1200:12) at processTicksAndRejections (internal/process/task_queues.js:80:21), code=404, statusCode=404

Im using the default config.yaml with the kubeConfig path set to my own which is successfully loaded.

The convertKubeconfig() Method inside the config.js of the kuberenetes-clinet module is using this config Object:

  clusters: [
    {
      caData: undefined,
      caFile: '/Users/simon/.minikube/ca.crt',
      name: 'minikube',
      server: 'https://192.168.99.101:8443',
      skipTLSVerify: false
    },
    {
      caData: undefined,
      caFile: '/Users/simon/.minikube/ca.crt',
      name: 'nestcloud-kubernetes-example',
      server: 'https://192.168.99.102:8443',
      skipTLSVerify: false
    }
  ],
  contexts: [
    {
      cluster: 'minikube',
      name: 'minikube',
      user: 'minikube',
      namespace: undefined
    },
    {
      cluster: 'nestcloud-kubernetes-example',
      name: 'nestcloud-kubernetes-config',
      user: 'minikube',
      namespace: 'nestcloud'
    }
  ],
  users: [
    {
      authProvider: undefined,
      certData: undefined,
      certFile: '/Users/simon/.minikube/client.crt',
      exec: undefined,
      keyData: undefined,
      keyFile: '/Users/simon/.minikube/client.key',
      name: 'minikube',
      token: undefined,
      password: undefined,
      username: undefined
    }
  ],
  currentContext: 'nestcloud-kubernetes-config'
}
cluster {
  caData: undefined,
  caFile: '/Users/simon/.minikube/ca.crt',
  name: 'minikube',
  server: 'https://192.168.99.101:8443',
  skipTLSVerify: false
}

The .config from .kubeconfig is defined like this:

apiVersion: v1
clusters:
- cluster:
    certificate-authority: /Users/simon/.minikube/ca.crt
    server: https://192.168.99.101:8443
  name: minikube
- cluster:
    certificate-authority: /Users/simon/.minikube/ca.crt
    server: https://192.168.99.102:8443
  name: nestcloud-kubernetes-example
contexts:
- context:
    cluster: minikube
    user: minikube
  name: minikube
- context:
    cluster: nestcloud-kubernetes-example
    namespace: nestcloud
    user: minikube
  name: nestcloud-kubernetes-config
current-context: minikube
kind: Config
preferences: {}
users:
- name: minikube
  user:
    client-certificate: /Users/simon/.minikube/client.crt
    client-key: /Users/simon/.minikube/client.key

I would appreciate any help to get any help to get this running thanks!

@miaowing
Copy link
Member

miaowing commented Jan 20, 2020

https://github.com/nest-cloud/nestcloud-kubernetes-example/tree/master/deploys

Sorry, you need deploy this configMap in the same namespace with the app:

apiVersion: v1
data:
  config.yaml: |-
    data:
      test: get config data from other config map.
kind: ConfigMap
metadata:
  name: nestcloud-kubernetes-config
  namespace: default

If you don't need this feature you can comment it out:

@Module({
  imports: [
    LoggerModule.register(),
    ScheduleModule.register(),
    BootModule.register(resolve(__dirname, '../configs'), 'config.yaml'),
    // ConfigModule.register({ dependencies: [NEST_KUBERNETES, NEST_BOOT] }),
    FeignModule.register(),
    ProxyModule.register({ dependencies: [NEST_BOOT] }),
    KubernetesModule.register({ dependencies: [NEST_BOOT] }),
    TerminusModule.forRootAsync({
      inject: [TypeOrmHealthIndicator],
      useFactory: db => getTerminusOptions(db as TypeOrmHealthIndicator),
    }),
  ],
  controllers: components(controllers),
  providers: components(services, clients),
})
export class AppModule {
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants