serverless / serverless-kubeless

This plugin enables support for Kubeless within the Serverless Framework.
Apache License 2.0
303 stars 80 forks source link

Cannot use with runtime NodeJs8.10 #164

Closed playtowork closed 5 years ago

playtowork commented 5 years ago

I want the runtime of my code to be NodeJs8.10. I ran the following steps:

serverless create --template kubeless-nodejs --path my-project
cd my-project
# modify the runtime in serverless.yml from "nodejs6" to "nodejs8.10", under both {"provider"} and {"capitalize" under "functions"}.
sudo npm install -g serverless-kubeless
sudo npm install
serverless deploy

But then, I get this error:

Serverless: Unable to find any running pod for capitalize. Retrying...
Serverless: Giving up, unable to retrieve the status of the capitalize deployment. 

/usr/local/lib/node_modules/serverless/lib/classes/Error.js:92
    throw new Error(e);
          ^
Error: Unable to retrieve the status of the capitalize deployment
    at module.exports.logError (/usr/local/lib/node_modules/serverless/lib/classes/Error.js:92:11)
    at process.on (/usr/local/lib/node_modules/serverless/bin/serverless:22:3)
    at emitTwo (events.js:126:13)
    at process.emit (events.js:214:7)
    at process.emit (/usr/local/lib/node_modules/serverless/node_modules/source-map-support/source-map-support.js:461:21)
    at methodName (/home/apoorv/intelease-box-2/node_modules/bluebird/js/release/debuggability.js:199:33)
    at activeFireEvent (/home/apoorv/intelease-box-2/node_modules/bluebird/js/release/debuggability.js:242:44)
    at fireRejectionEvent (/home/apoorv/intelease-box-2/node_modules/bluebird/js/release/debuggability.js:632:14)
    at Promise._notifyUnhandledRejection (/home/apoorv/intelease-box-2/node_modules/bluebird/js/release/debuggability.js:65:9)
    at Timeout._onTimeout (/home/apoorv/intelease-box-2/node_modules/bluebird/js/release/debuggability.js:44:14)
    at ontimeout (timers.js:482:11)
    at tryOnTimeout (timers.js:317:5)
    at Timer.listOnTimeout (timers.js:277:5)

So then, I changed back the runtime to "nodejs6" in serverless.yml and tried serverless deploy again. This time, it successfully deployed. Now, I try changing the runtime back from "nodejs6" to "nodejs8.10" and again serverless deploy. I see no error in the deploy, but the pod is also not restarted.

Can you please tell me the proper way to run the code with runtime NodeJs 8.10?

playtowork commented 5 years ago

Turns out I was doing two things wrong. First, I saw this:

kubeless get-server-config
INFO[0000] Current Server Config:                       
INFO[0000] Supported Runtimes are: ballerina0.981.0, dotnetcore2.0, dotnetcore2.1, go1.10, java1.8, nodejs6, nodejs8, php7.2, python2.7, python3.4, python3.6, python3.7, ruby2.3, ruby2.4, ruby2.5, jvm1.8, nodejs_distroless8, nodejsCE8

So "nodejs8.10" was not even an option. After I fixed that (using "nodejs8" instead), my other problem was the namespace in my serverless.yml file. I had a couple environments setup, and the other had a different namespace than this one. So the function was running for the other namespace as well. serverless deploy was deploying to the other namespace, but I was testing out the function with this namespace.