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

Python or Node examples: ENOENT error #149

Open
philwinder opened this Issue Aug 28, 2018 · 5 comments

Comments

Projects
None yet
2 participants
@philwinder

philwinder commented Aug 28, 2018

Performing this example: https://github.com/serverless/serverless-kubeless#try-out-the-example

I get this error. Not sure what the problem is.

Thanks.

SLS_DEBUG=* serverless deploy
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command create
Serverless: Load command install
Serverless: Load command package
Serverless: Load command deploy
Serverless: Load command deploy:function
Serverless: Load command deploy:list
Serverless: Load command deploy:list:functions
Serverless: Load command invoke
Serverless: Load command invoke:local
Serverless: Load command info
Serverless: Load command logs
Serverless: Load command login
Serverless: Load command logout
Serverless: Load command metrics
Serverless: Load command print
Serverless: Load command remove
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command slstats
Serverless: Load command plugin
Serverless: Load command plugin
Serverless: Load command plugin:install
Serverless: Load command plugin
Serverless: Load command plugin:uninstall
Serverless: Load command plugin
Serverless: Load command plugin:list
Serverless: Load command plugin
Serverless: Load command plugin:search
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command info
Serverless: Load command logs
Serverless: Invoke deploy
Serverless: Invoke package
Serverless: Packaging service...
Serverless: Excluding development dependencies...

  Error --------------------------------------------------

  ENOENT: no such file or directory, open

     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

  Stack Trace --------------------------------------------

Error: ENOENT: no such file or directory, open
    at Object.openSync (fs.js:434:3)
    at Object.readFileSync (fs.js:339:35)
    at _.each.configFile (/Users/phil-mac/source/serverless/serverless-kubeless/examples/get-python/node_modules/serverless-kubeless/lib/helpers.js:39:43)
    at arrayEach (/Users/phil-mac/source/serverless/serverless-kubeless/examples/get-python/node_modules/lodash/lodash.js:516:11)
    at Function.forEach (/Users/phil-mac/source/serverless/serverless-kubeless/examples/get-python/node_modules/lodash/lodash.js:9342:14)
    at Object.loadKubeConfig (/Users/phil-mac/source/serverless/serverless-kubeless/examples/get-python/node_modules/serverless-kubeless/lib/helpers.js:38:7)
    at new Config (/Users/phil-mac/source/serverless/serverless-kubeless/examples/get-python/node_modules/serverless-kubeless/lib/config.js:29:60)
    at KubelessDeploy.deployFunction (/Users/phil-mac/source/serverless/serverless-kubeless/examples/get-python/node_modules/serverless-kubeless/deploy/kubelessDeploy.js:84:28)
From previous event:
    at PluginManager.invoke (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:390:22)
    at PluginManager.run (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:421:17)
    at variables.populateService.then.then (/usr/local/lib/node_modules/serverless/lib/Serverless.js:157:33)
    at runCallback (timers.js:693:18)
    at tryOnImmediate (timers.js:664:5)
    at processImmediate (timers.js:646:5)
    at process.topLevelDomainCallback (domain.js:121:23)
From previous event:
    at Serverless.run (/usr/local/lib/node_modules/serverless/lib/Serverless.js:144:8)
    at serverless.init.then (/usr/local/lib/node_modules/serverless/bin/serverless:43:50)

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information -----------------------------
     OS:                     darwin
     Node Version:           10.9.0
     Serverless Version:     1.30.2
@andresmgot

This comment has been minimized.

Collaborator

andresmgot commented Aug 28, 2018

Hi @philwinder, apparently there is an error with the environment variable KUBECONFIGin your system. Maybe you have it defined to a missing path?

@philwinder

This comment has been minimized.

philwinder commented Aug 28, 2018

Ah, well spotted. So this particular error is because something in serverless-kubeless doesn't like the path-like colon syntax, which is used in various places for the KUBECONFIG env var. E.g. see the docs here.

Once I removed the colon and just specified the single kubeconfig, it got further. But now I get this error:

$ echo $KUBECONFIG
/Users/phil-mac/.kube/config-jenkins

$ SLS_DEBUG=* serverless deploy
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command create
Serverless: Load command install
Serverless: Load command package
Serverless: Load command deploy
Serverless: Load command deploy:function
Serverless: Load command deploy:list
Serverless: Load command deploy:list:functions
Serverless: Load command invoke
Serverless: Load command invoke:local
Serverless: Load command info
Serverless: Load command logs
Serverless: Load command login
Serverless: Load command logout
Serverless: Load command metrics
Serverless: Load command print
Serverless: Load command remove
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command slstats
Serverless: Load command plugin
Serverless: Load command plugin
Serverless: Load command plugin:install
Serverless: Load command plugin
Serverless: Load command plugin:uninstall
Serverless: Load command plugin
Serverless: Load command plugin:list
Serverless: Load command plugin
Serverless: Load command plugin:search
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command info
Serverless: Load command logs
Serverless: Invoke deploy
Serverless: Invoke package
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Unable to find required information for authenticating against the cluster
Unable to find required information for authenticating against the cluster

/Users/phil-mac/source/serverless/serverless-kubeless/examples/get-python/node_modules/serverless-kubeless/lib/config.js:56
      return JSON.parse(this.configMag.data[key]);
                                           ^
TypeError: Cannot read property 'runtime-images' of undefined
    at Config.get (/Users/phil-mac/source/serverless/serverless-kubeless/examples/get-python/node_modules/serverless-kubeless/lib/config.js:56:44)
    at Object.getRuntimeDepfile (/Users/phil-mac/source/serverless/serverless-kubeless/examples/get-python/node_modules/serverless-kubeless/lib/helpers.js:182:34)
    at ReadStream.s.on (/Users/phil-mac/source/serverless/serverless-kubeless/examples/get-python/node_modules/serverless-kubeless/deploy/kubelessDeploy.js:103:39)
    at ReadStream.emit (events.js:187:15)
    at ReadStream.EventEmitter.emit (domain.js:442:20)
    at endReadableNT (_stream_readable.js:1085:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)

What is it trying to read? My kubeconfig is in yaml format, not json.

@andresmgot

This comment has been minimized.

Collaborator

andresmgot commented Aug 29, 2018

Now it seems that the plugin is not able to authenticate against the cluster with the credentials in your KUBECONFIG. What is the method used there to authenticate? Which platform and version of K8s are you running?

@philwinder

This comment has been minimized.

philwinder commented Aug 30, 2018

Thanks @andresmgot.

I forgot to note, the examples in the getting started guide work successfully. So I believe it's specific to the serverless-kubeless plugin.

Kubernetes running on AWS EKS.

$ kubectl version --short
Client Version: v1.11.1
Server Version: v1.10.3

Redacted:

$ cat ~/.kube/config-jenkins
apiVersion: v1
clusters:
- cluster:
    server: https://XXXXX.XXX.us-east-1.eks.amazonaws.com
    certificate-authority-data: XXXXXXXX...
  name: kubernetes
contexts:
- context:
    cluster: kubernetes
    user: aws
  name: aws
current-context: aws
kind: Config
preferences: {}
users:
- name: aws
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1alpha1
      command: aws-iam-authenticator
      args:
        - "token"
        - "-i"
        - "jenkins"
@andresmgot

This comment has been minimized.

Collaborator

andresmgot commented Aug 30, 2018

I see, the problem is that the library we are using to connect to the K8s cluster still doesn't support EKS authentication. See: godaddy/kubernetes-client#306 (note that the go library does, that's why you can still use the kubeless binary).

As suggested in that issue you can try to use a service account token to authenticate instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment