serverless / serverless-kubeless

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

Error 404 -while trying to access read-all function of todo backend app #115

Open monikagupta78 opened 6 years ago

monikagupta78 commented 6 years ago

I have deployed todo-app/backend/ app in GKE. while trying to access I am getting error 404.

To me it looks like an issue with ingress setup. I can see two ingress entries when I run below command:

kubectl get ingress
NAME            HOSTS                  ADDRESS       PORTS     AGE
basic-ingress   *                      35.190.11.9   80        12d
todos           35.185.19.186.xip.io                 80        16h

and the configuration todo yml file is:

 # Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/rewrite-target: /
  creationTimestamp: 2018-04-24T11:43:58Z
  generation: 3
  name: todos
  namespace: default
  resourceVersion: "2514019"
  selfLink: /apis/extensions/v1beta1/namespaces/default/ingresses/todos
  uid: c63bd143-47b4-11e8-8366-42010a8e0105
spec:
  rules:
  - host: 35.185.19.186.xip.io
    http:
      paths:
      - backend:
          serviceName: create
          servicePort: 8080
        path: /create
      - backend:
          serviceName: read-all
          servicePort: 8080
        path: /read-all
      - backend:
          serviceName: read-one
          servicePort: 8080
        path: /read
      - backend:
          serviceName: update
          servicePort: 8080
        path: /update
      - backend:
          serviceName: delete
          servicePort: 8080
        path: /delete
status:
  loadBalancer: {}

Configuration of basic-ingress is :

# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    ingress.kubernetes.io/backends: '{"k8s-be-31459--852d88a6b447d59d":"HEALTHY"}'
    ingress.kubernetes.io/forwarding-rule: k8s-fw-default-basic-ingress--852d88a6b447d59d
    ingress.kubernetes.io/target-proxy: k8s-tp-default-basic-ingress--852d88a6b447d59d
    ingress.kubernetes.io/url-map: k8s-um-default-basic-ingress--852d88a6b447d59d
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":{"annotations":{},"name":"basic-ingress","namespace":"default"},"spec":{"backend":{"serviceName":"todos","servicePort":80}}}
  creationTimestamp: 2018-04-12T10:58:38Z
  generation: 3
  name: basic-ingress
  namespace: default
  resourceVersion: "2512980"
  selfLink: /apis/extensions/v1beta1/namespaces/default/ingresses/basic-ingress
  uid: 748163de-3e40-11e8-8366-42010a8e0105
spec:
  backend:
    serviceName: todos
    servicePort: 80
status:
  loadBalancer:
    ingress:
    - ip: 35.190.11.9

I am not very sure of this configuration of ingress, can someone help pls?

All my todos functions been deployed successfully:

D:\serverless\serverless-kubeless\examples\todo-app\backend>kubectl get services
NAME         TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)           AGE
create       ClusterIP   10.15.241.200   <none>        8080/TCP          2h
delete       ClusterIP   10.15.254.8     <none>        8080/TCP          2h
hello        ClusterIP   10.15.245.239   <none>        8080/TCP          18d
kubernetes   ClusterIP   10.15.240.1     <none>        443/TCP           21d
mongodb      NodePort    10.15.245.199   <none>        27017:30505/TCP   2h
read-all     ClusterIP   10.15.243.242   <none>        8080/TCP          2h
read-one     ClusterIP   10.15.248.185   <none>        8080/TCP          2h
update       ClusterIP   10.15.253.150   <none>        8080/TCP          2h
andresmgot commented 6 years ago

The problem of GKE is that the default Ingress Controller only works for services exposing a NodePort. See this issue. You need to either edit the services to change ClusterIP for NodePort or deploy a different Ingress Controller. You can find guides here: http://kubeless.io/docs/http-triggers/

monikagupta78 commented 6 years ago

I am still unable to setup another ingress constroller. is there a way to test these functions without going through load balancer?

and can you let me know how to make this change that you suggested- edit the services to change ClusterIP for NodePort ?

andresmgot commented 6 years ago

I am still unable to setup another ingress constroller. is there a way to test these functions without going through load balancer?

The functions are accessible within the cluster by default but for using the frontend web application you need to expose them with an ingress object.

and can you let me know how to make this change that you suggested- edit the services to change ClusterIP for NodePort ?

If you execute kubectl edit service create it will open a text editor in which you can modify the value type: ClusterIP for type: NodePort. Once you do that for all the services of the example you should see that the ingress object todos have an address associated. At that point you should be able to call them executing curl <IP>/read-all for example.

monikagupta78 commented 6 years ago

I edited all five functions, but I don't see IP being associated to todos ingress object. do I need to redeploy or something?

D:\serverless\serverless-kubeless\examples\todo-app\backend>kubectl get ing NAME HOSTS ADDRESS PORTS AGE todos 35.185.19.186.xip.io 80 21h

This is not changing.

On Thu, Apr 26, 2018 at 1:38 PM Andres notifications@github.com wrote:

I am still unable to setup another ingress constroller. is there a way to test these functions without going through load balancer?

The functions are accessible within the cluster by default but for using the frontend web application you need to expose them with an ingress object.

and can you let me know how to make this change that you suggested- edit the services to change ClusterIP for NodePort ?

If you execute kubectl edit service create it will open a text editor in which you can modify the value type: ClusterIP for type: NodePort. Once you do that for all the services of the example you should see that the ingress object todos have an address associated. At that point you should be able to call them executing curl /read-all for example.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/serverless/serverless-kubeless/issues/115#issuecomment-384551763, or mute the thread https://github.com/notifications/unsubscribe-auth/AIa7NHheann3o_vL7mrT49xhglqNfcUXks5tsYBsgaJpZM4Tiv1a .

monikagupta78 commented 6 years ago

I also set it up on minikube. ingress object is created, IP is also assigned but still the function is not accessible using that IP.

This is the status of my services and ing object. C:>kubectl get services NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE create ClusterIP 10.110.155.95 8080/TCP 1h delete ClusterIP 10.108.77.2 8080/TCP 1h kubernetes ClusterIP 10.96.0.1 443/TCP 3h mongodb NodePort 10.101.46.55 27017:31022/TCP 3h read-all ClusterIP 10.100.115.100 8080/TCP 1h read-one ClusterIP 10.107.91.86 8080/TCP 1h update ClusterIP 10.100.94.115 8080/TCP 1h

C:>kubectl get ing NAME HOSTS ADDRESS PORTS AGE todos 192.168.99.100.xip.io 10.0.2.15 80 40m

I am trying to check read-all in browser/postman - but it says site can not be reached. I am just trying to access these functions using postman. Am I missing anything? I have setup minikube on windows machine, installed kubeless, enabled ingress. Pls guide.

Thanks Monika

On Thu, Apr 26, 2018 at 2:02 PM Monika Gupta monikagupta78@gmail.com wrote:

I edited all five functions, but I don't see IP being associated to todos ingress object. do I need to redeploy or something?

D:\serverless\serverless-kubeless\examples\todo-app\backend>kubectl get ing NAME HOSTS ADDRESS PORTS AGE todos 35.185.19.186.xip.io 80 21h

This is not changing.

On Thu, Apr 26, 2018 at 1:38 PM Andres notifications@github.com wrote:

I am still unable to setup another ingress constroller. is there a way to test these functions without going through load balancer?

The functions are accessible within the cluster by default but for using the frontend web application you need to expose them with an ingress object.

and can you let me know how to make this change that you suggested- edit the services to change ClusterIP for NodePort ?

If you execute kubectl edit service create it will open a text editor in which you can modify the value type: ClusterIP for type: NodePort. Once you do that for all the services of the example you should see that the ingress object todos have an address associated. At that point you should be able to call them executing curl /read-all for example.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/serverless/serverless-kubeless/issues/115#issuecomment-384551763, or mute the thread https://github.com/notifications/unsubscribe-auth/AIa7NHheann3o_vL7mrT49xhglqNfcUXks5tsYBsgaJpZM4Tiv1a .

andresmgot commented 6 years ago

If you use Minikube the Ingress won't give you a public IP so you won't be able to access it from a public service like postman.

Let me try to reproduce your issue in GKE, I will give you more information about it when I have a chance to follow the setup steps.

monikagupta78 commented 6 years ago

sure, thanks. Pls update me once you are able to replicate the same.

On Thu, Apr 26, 2018 at 9:48 PM Andres notifications@github.com wrote:

If you use Minikube the Ingress won't give you a public IP so you won't be able to access it from a public service like postman.

Let me try to reproduce your issue in GKE, I will give you more information about it when I have a chance to follow the setup steps.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/serverless/serverless-kubeless/issues/115#issuecomment-384701889, or mute the thread https://github.com/notifications/unsubscribe-auth/AIa7NPvefWfKWobE0WdJPYhVDkKd-61jks5tsfNigaJpZM4Tiv1a .

andresmgot commented 6 years ago

@monikagupta78 I have updated the guide for running the TODO example in GKE. Can you follow the guide at https://github.com/andresmgot/serverless-kubeless/blob/9731ab03f66e0d2354d8a80294a0aa46b742179d/examples/todo-app/backend/README.md#running-the-backend-in-gke and let me know if you get the same result?

monikagupta78 commented 6 years ago

I tried all setup again, could see the IP being assigned. I am trying to invoke the backend functions, can't i test that in browser or postman? I am not still not able to. when I am invoking read-all function using kubless cli, it just comes out, doesnt even return empty array []. can't I test without the frontend app? one more Qs, I had changed the clusterIP to nodeport, do I need to revert that change?

Thanks Monika

On Fri, Apr 27, 2018 at 4:15 PM Andres notifications@github.com wrote:

@monikagupta78 https://github.com/monikagupta78 I have updated the guide for running the TODO example in GKE. Can you follow the guide at https://github.com/andresmgot/serverless-kubeless/blob/9731ab03f66e0d2354d8a80294a0aa46b742179d/examples/todo-app/backend/README.md#running-the-backend-in-gke and let me know if you get the same result?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/serverless/serverless-kubeless/issues/115#issuecomment-384935029, or mute the thread https://github.com/notifications/unsubscribe-auth/AIa7NEelMWHmGH3HebKVGD3yD3Vi2vNuks5tsvbAgaJpZM4Tiv1a .

andresmgot commented 6 years ago

I am trying to invoke the backend functions, can't i test that in browser or postman?

Yes, as far as the IP it assign you is public you should be able to reach it.

I am not still not able to. when I am invoking read-all function using kubless cli, it just comes out, doesnt even return empty array []. can't I test without the frontend app?

That may be cause by an error in the function or a misconfiguration. What does curl -v <your ip>.nip.io returns? Did you modify the host of the Ingress object?

I had changed the clusterIP to nodeport, do I need to revert that change?

AFAIK you don't need to but I recommend you to do so.

monikagupta78 commented 6 years ago

It seems to be working, looks like proxy was the issue. I am getting response for read-all like below: [{"_id":"5ae00d316d04cf1fa3725c02","id":"a09c2b60-4846-11e8-a0b7-a7edc07a3c98","updatedAt":1524632881430},{"_id":"5aea8b6f6d04cfd863725c03","id":"c0adb080-4e87-11e8-a0b7-a7edc07a3c98","updatedAt":1525320559496},{"_id":"5aea8bab6d04cf326d725c04","id":"e4343ba0-4e87-11e8-a0b7-a7edc07a3c98","updatedAt":1525320619098},{"_id":"5aea8bd76d04cf68cc725c05","id":"feaafb90-4e87-11e8-a0b7-a7edc07a3c98","updatedAt":1525320663497},{"_id":"5aeaa39c6d04cf368b725c06","desc":"Create first todo","id":"29be2bf0-4e96-11e8-a0b7-a7edc07a3c98","updatedAt":1525326748719}]

Had created one entry using postman - {"desc":"Create first todo"}

I could see that in read-all. Hope this is the expected behavior.

Thanks for your support.

On Wed, May 2, 2018 at 8:31 PM Andres notifications@github.com wrote:

I am trying to invoke the backend functions, can't i test that in browser or postman?

Yes, as far as the IP it assign you is public you should be able to reach it.

I am not still not able to. when I am invoking read-all function using kubless cli, it just comes out, doesnt even return empty array []. can't I test without the frontend app?

That may be cause by an error in the function or a misconfiguration. What does curl -v .nip.io returns? Did you modify the host of the Ingress object?

I had changed the clusterIP to nodeport, do I need to revert that change?

AFAIK you don't need to but I recommend you to do so.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/serverless/serverless-kubeless/issues/115#issuecomment-386008837, or mute the thread https://github.com/notifications/unsubscribe-auth/AIa7NNe61LtE5IUmYeCQSGu_oFwF0OmXks5tuco9gaJpZM4Tiv1a .