Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

run function gives 500 #63

Closed
sonalkr132 opened this issue Apr 24, 2018 · 3 comments
Closed

run function gives 500 #63

sonalkr132 opened this issue Apr 24, 2018 · 3 comments

Comments

@sonalkr132
Copy link

Hi, I have deployed kubeless v0.6.0 and kubeless-ui on kubernetes 1.10. I created test.foobar function using quick-start. I can call the function from kubeless as mentioned in guide:

$ kubeless function call get-python --data '{"echo": "echo echo"}'
{"echo": "echo echo"}

However, when I try to run function using ui, I get nothing back. In browser console, I see response to POST http://<ui-pod-ip>:3000/proxy is 500 and request payload has following:

{url: "http://localhost:8080/api/v1/proxy/namespaces/kubeless/services/get-python:8080",…}
headers:{event-id: "ui-11ebb8bc32f0", event-time: "2018-04-24T14:42:21.809Z", event-type: "application/json",…}
Accept:"application/json"
Content-Type:"application/json"
X-Requested-With:"XMLHttpRequest"
event-id:"ui-11ebb8bc32f0"
event-namespace:"ui.kubeless.io"
event-time:"2018-04-24T14:42:21.809Z"
event-type:"application/json"
json:"{"hi":"d"}"
method:"post"
url:"http://localhost:8080/api/v1/proxy/namespaces/kubeless/services/get-python:8080"

I ran kubectl proxy -p 8080 locally and tried following:

 $ curl http://localhost:8080/api/v1/proxy/namespaces/kubeless/services/get-python
{
  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {  },
  "status": "Failure",
  "message": "the server could not find the requested resource",
  "reason": "NotFound",
  "details": {  },
  "code": 404
}

is this url correct? As per kubernetes doc, shouldn't this be localhost:8080/api/v1/namespaces/kubeless/services/get-python:8080/proxy?

@andresmgot
Copy link
Contributor

Hi @sonalkr132, did you run the UI using the manifest at?:

kubectl create -f https://raw.githubusercontent.com/kubeless/kubeless-ui/master/k8s.yaml

Also, how are you accessing the UI? By default it expose a NodePort that is the one that can be used to access the service.

Finally note that both URLs are correct:

$ curl 127.0.0.1:8080/api/v1/namespaces/default/services/get-python:8080/proxy/
hello world
$ curl 127.0.0.1:8080/api/v1/proxy/namespaces/default/services/get-python:8080/
hello world

@sonalkr132
Copy link
Author

did you run the UI using the manifest at?:

yes, I used the same.

how are you accessing the UI?|

ui services exposes 3000 on host using NodePort as you mentioned. I am using <ui-host-ip>:3000 to access UI.

both URLs are correct:

can you please re-confirm this? I used following steps:

$ minikube start --kubernetes-version v1.10.0
$ kubectl config use-context minikube
$ export RELEASE=v0.6.0
$ kubectl create ns kubeless
$ kubectl create -f https://github.com/kubeless/kubeless/releases/download/$RELEASE/kubeless-non-rbac-$RELEASE.yaml
$ cat <<EOT >> test.py
def foobar(event, context):
  print event
  return event['data']
EOT
$ kubeless function deploy get-python --runtime python2.7  --from-file test.py   --handler test.foobar
$ kubectl proxy -p 8080 &
$ curl -L --data '{"Another": "Echo"}' \
>   --header "Content-Type:application/json" \
>   localhost:8080/api/v1/proxy/namespaces/default/services/get-python:8080/
{  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {  },
  "status": "Failure",
  "message": "the server could not find the requested resource",
  "reason": "NotFound",
  "details": {  },
  "code": 404
}
$ curl --data '{"Another": "Echo"}'   --header "Content-Type:application/json"   localhost:8080/api/v1/namespaces/default/services/get-python:http-function-port/proxy/
{"Another": "Echo"}

@andresmgot
Copy link
Contributor

Oh, it seems that it is a 1.10 change: kubernetes/kubernetes#59884 (I checked it in 1.9). Thanks for reporting this, I will update the UI.

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

No branches or pull requests

2 participants