kubeless icon indicating copy to clipboard operation
kubeless copied to clipboard

FATA[002] when trying to expose a function via http trigger on EKS

Open andrea-spoldi opened this issue 4 years ago • 8 comments

Is this a BUG REPORT or FEATURE REQUEST?: BUG REPORT

What happened: I'm trying to expose a function deployed on a AWS EKS Cluster with http-trigger; either by using kong ingress controller or nginx ingress controller I get a fatal error

What you expected to happen: the ingress creation for the function is created and function gets exposed

How to reproduce it (as minimally and precisely as possible): kubeless trigger http create hello-ingress --function-name hello --gateway nginx FATA[0002] Can not create out-of-cluster client: stat :/Users/andreaspoldi/.kube/config: no such file or directory

Anything else we need to know?: my kubeconfig exists and it is the proper path..other kubeless commands works okay

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

my kubeconfig is generated like this aws eks --region region update-kubeconfig --name cluster_name as per AWS documentation https://docs.aws.amazon.com/eks/latest/userguide/create-kubeconfig.html

Environment:

  • Kubernetes version (use kubectl version): Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.1", GitCommit:"b7394102d6ef778017f2ca4046abbaa23b88c290", GitTreeState:"clean", BuildDate:"2019-04-08T17:11:31Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"darwin/amd64"} Server Version: version.Info{Major:"1", Minor:"14+", GitVersion:"v1.14.9-eks-c0eccc", GitCommit:"c0eccca51d7500bb03b2f163dd8d534ffeb2f7a2", GitTreeState:"clean", BuildDate:"2019-12-22T23:14:11Z", GoVersion:"go1.12.12", Compiler:"gc", Platform:"linux/amd64"}

  • Kubeless version (use kubeless version): Kubeless version: v1.0.5-dirty

  • Cloud provider or physical cluster: AWS EKS

Thanks

andrea-spoldi avatar Jan 09 '20 10:01 andrea-spoldi

Mm, it's a weird behavior. Are you able to create functions as well? Is your kubeconfig elsewhere? (Note that you can configure the kube config path setting the env var KUBECONFIG).

andresmgot avatar Jan 09 '20 12:01 andresmgot

@andresmgot thanks for replying

I am able to deploy functions and trigger them via CLI using the same kubeconfig

kubeless function call hello --data '{"user": "Andre"}' Hello Andre!

I can list them and delete them no problem

BUT, if I try to set manually the KUBECONFIG env var the trigger works too

KUBECONFIG=/Users/andreaspoldi/.kube/config kubeless trigger http create hello-ingress --function-name hello --gateway nginx INFO[0001] HTTP trigger hello-ingress created in namespace default successfully!

never thought I could try this...I wonder then how come "other" commands works and only the trigger's does not

andrea-spoldi avatar Jan 09 '20 16:01 andrea-spoldi

Then the error message doesn't make a lot of sense:

FATA[0002] Can not create out-of-cluster client: stat :/Users/andreaspoldi/.kube/config: no such file or directory

If the file really exists, I am not sure why it's failing. To be able to isolate the issue, does it happen for you for the rest of commands for the http trigger? kubeless trigger http delete/list/update ... or only when creating?

andresmgot avatar Jan 10 '20 08:01 andresmgot

@andresmgot yes it does, it seems like only "triggers" command are affected

kubeless trigger http list 
FATA[0000] Can not create out-of-cluster client: stat :/Users/andreaspoldi/.kube/config: no such file or directory

andrea-spoldi avatar Jan 13 '20 14:01 andrea-spoldi

@andresmgot yes it does, it seems like only "triggers" command are affected

kubeless trigger http list 
FATA[0000] Can not create out-of-cluster client: stat :/Users/andreaspoldi/.kube/config: no such file or directory

I know this is an old thread, but I just stumbled on this behavior in the current build (of everything : ). For me, the problem was that I had multiple config files specified in my KUBECONFIG environment variable. Seeing the ":" before "/Users" in your error message makes me believe you may as well.

jeffreybreen avatar Oct 21 '20 17:10 jeffreybreen

And if that does have anything to do with it, perhaps it's because BuildOutOfClusterConfig() in cronjob-trigger/pkg/utils/k8sutil.go lacks the call to NewNonInteractiveDeferredLoadingClientConfig() etc. which the version in kubeless/pkg/utils/k8sutil.go has...

jeffreybreen avatar Oct 21 '20 20:10 jeffreybreen

thanks for the report @jeffreybreen, maybe you can give it a try and send a PR?

andresmgot avatar Oct 22 '20 07:10 andresmgot

thanks for the report @jeffreybreen, maybe you can give it a try and send a PR?

Thanks for the nudge -- you got it! https://github.com/kubeless/cronjob-trigger/pull/16

Copy-and-paste is my specialty : ) Jeffrey

jeffreybreen avatar Oct 24 '20 15:10 jeffreybreen