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

Unable to post in configmaps #667

Open
chiragob opened this issue Aug 20, 2020 · 0 comments
Open

Unable to post in configmaps #667

chiragob opened this issue Aug 20, 2020 · 0 comments

Comments

@chiragob
Copy link

Unable to post in configmaps

I am working on minikube

this is the minikube start command log

* minikube 1.12.3 is available! Download it: https://github.com/kubernetes/minikube/releases/tag/v1.12.3
* To disable this notice, run: 'minikube config set WantUpdateNotification false'

! minikube v1.7.3 on Ubuntu 16.04
* Using the virtualbox driver based on existing profile
* Reconfiguring existing host ...
* Starting existing virtualbox VM for "minikube" ...
* Preparing Kubernetes v1.17.3 on Docker 19.03.6 ...
* Launching Kubernetes ... 
* Enabling addons: default-storageclass, storage-provisioner
* Done! kubectl is now configured to use "minikube"

this is my config.json

{
   "apiVersion": "v1",
   "kind": "ConfigMap",
   "metadata": {
      "name": "corredor-config",
      "namespace": "default"
   },
   "data": {
      "CORREDOR_LISTENER": "0.0.0.0:80",
      "CORREDOR_ENV": "prod",
      "CORREDOR_LOG_ENABLED": "true",
      "CORREDOR_LOG_LEVEL": "debug",
      "CORREDOR_LOG_PRETTY": "true"
   }
}

this is my index.js file

const Client = require('kubernetes-client').Client
const { KubeConfig } = require('kubernetes-client')
const kubeconfig = new KubeConfig()
kubeconfig.loadFromFile('/home/software/.kube/config')
const Request = require('kubernetes-client/backends/request')

const backend = new Request({ kubeconfig })
const client = new Client({ backend, version: '1.13' })

async function main() {
    const namespaces = await client.api.v1.namespaces.get()
    // ------------- Config -------------
    // create corredor
    const configCorredor = require('./config/corredor.json')
    create = await client.apis.apps.v1.namespaces('default').configmaps.post({ body: configCorredor }).catch((err)=>{
        console.log("Corredor Config err:", err);
    });
}
main()

this is the error

(node:21122) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'post' of undefined
    at main (/var/www/corteza/corteza-local/kubeclient/index.js:21:72)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:21122) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:21122) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

please help me

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

1 participant