Skip to content
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

Add example using grpc and http2 #39

Closed
aledbf opened this issue Dec 1, 2016 · 11 comments
Closed

Add example using grpc and http2 #39

aledbf opened this issue Dec 1, 2016 · 11 comments
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.

Comments

@aledbf
Copy link
Member

aledbf commented Dec 1, 2016

No description provided.

@aledbf aledbf added enhancement help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Dec 1, 2016
@aledbf
Copy link
Member Author

aledbf commented Dec 30, 2016

Something like this should work:

https://github.com/caiofilipini/grpc-weather/

  • create deployment
kubectl run \
  --image=caiofilipini/grpc-weather:master grpc-weather \
  --port=9000 \
  --env="OPEN_WEATHER_MAP_API_KEY=<token from http://openweathermap.org/api>" \
  --env="WEATHER_UNDERGROUND_API_KEY=<token from http://openweathermap.org/api>"
  • expose service
kubectl expose deployment grpc-weather --port=9000 --name=grpc-weather
  • create ingress
echo "
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: grpc-weather
spec:
  rules:
  - host: grpc-weather
    http:
      paths:
      - backend:
          serviceName: grpc-weather
          servicePort: 9000
        path: /
" | kubectl create -f -
  • use docker image to run the client
docker run \
  --rm \
  -it \
  --name weather_service \
  --entrypoint bash \
  --net=host \
  caiofilipini/grpc-weather:master
  • execute
echo "<grpc-weather svc IP> grpc-weather" >>/etc/hosts
curl -v <grpc-weather svc IP>:80 -H 'Host: grpc-weather"
make build-client
./weather_client/client --s grpc-weather --p 80 Santiago

@krancour
Copy link
Member

krancour commented Apr 3, 2017

@aledbf I haven't tried, but does this work? I recently tried using a different upstream grpc service and requests kept failing because of connection reset by peer.

@aledbf
Copy link
Member Author

aledbf commented Apr 3, 2017

@krancour works if you use the ssl-passthrough annotation, i.e. just use nginx for the TLS hello and then terminate SSL in the pod (this is because nginx does not support http2 in the upstream)

@krancour
Copy link
Member

krancour commented Apr 3, 2017

@aledbf ahhh... thanks! I will try that.

@philipithomas
Copy link

can a grpc server listen on port 80? More specifically - how can ssl-passthrough be configured for port 80?

@aledbf
Copy link
Member Author

aledbf commented Jun 28, 2017

@philipithomas I just answered this in your issue :)

@drigz
Copy link
Contributor

drigz commented Aug 17, 2017

For others following this trail, the other issue is #923.

@nlamirault
Copy link
Contributor

I would like to use an nginx ingress controller to expose a grpc-gateway service. The gRPC services are on 8080 and the REST gateway on 9090.
I create theses ingresses :

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: nginx
    ingress.kubernetes.io/ssl-redirect: "true"
  name: diablo-http
  namespace: nimbus
spec:
  rules:
  - host: diablo.caas.net
    http:
      paths:
      - path: /
        backend:
          serviceName: diablo
          servicePort: 9090
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: nginx
    ingress.kubernetes.io/ssl-passthrough: "true"
  name: diablo-grpc
  namespace: nimbus
spec:
  rules:
  - host: diablo-rpc.caas.net
    http:
      paths:
      - path: /
        backend:
          serviceName: diablo
          servicePort: 8080

A HTTP request to diablo.caas.net works fine, but the CLI which use the gRPC backend is not working with diablo-rpc.caas.net.
Any idea how can i do that ?

@bowei
Copy link
Member

bowei commented Oct 11, 2017

This issue was moved to kubernetes/ingress-gce#18

@bowei bowei closed this as completed Oct 11, 2017
@aledbf
Copy link
Member Author

aledbf commented Mar 17, 2018

Today NGINX released a new version with support for gRPC
https://www.nginx.com/blog/nginx-1-13-10-grpc

@pcj pcj mentioned this issue Apr 2, 2018
@nextgentm1
Copy link

@aledbf is there a way of receiving an HTTP/2 request over https via NGINX Ingress, and using ssl-passthrough, receiving an HTTP/2 request in the pod?

I'd like to keep the protocol as HTTP/2 not HTTP/1.1 between NGINX Ingress Controller and the pod. Any way of achieving this?

haoqing0110 referenced this issue in stolostron/management-ingress Mar 5, 2021
haoqing0110 referenced this issue in stolostron/management-ingress Mar 5, 2021
haoqing0110 referenced this issue in stolostron/management-ingress Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.
Projects
None yet
Development

No branches or pull requests

7 participants