Something like this should work:
https://github.com/caiofilipini/grpc-weather/
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>"
kubectl expose deployment grpc-weather --port=9000 --name=grpc-weather
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 -
docker run \
--rm \
-it \
--name weather_service \
--entrypoint bash \
--net=host \
caiofilipini/grpc-weather:master
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
@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.
@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)
@aledbf ahhh... thanks! I will try that.
can a grpc server listen on port 80? More specifically - how can ssl-passthrough be configured for port 80?
@philipithomas I just answered this in your issue :)
For others following this trail, the other issue is #923.
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 ?
This issue was moved to kubernetes/ingress-gce#18
Today NGINX released a new version with support for gRPC
https://www.nginx.com/blog/nginx-1-13-10-grpc
@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?
Most helpful comment
@aledbf is there a way of receiving an
HTTP/2request over https via NGINX Ingress, and usingssl-passthrough, receiving anHTTP/2request 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?