1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-06 06:46:26 +01:00
Files
openshift-docs/modules/interacting-serverless-apps-http2-gRPC.adoc
2020-09-30 18:43:42 +00:00

73 lines
2.3 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Module included in the following assemblies:
//
// * serverless/serving-creating-managing-apps.adoc
[id="interacting-serverless-apps-http2-gRPC_{context}"]
= Interacting with a serverless application using HTTP2 and gRPC
{ServerlessProductName} supports only insecure or edge-terminated routes.
Insecure or edge-terminated routes do not support HTTP2 on {product-title}.
These routes also do not support gRPC because gRPC is transported by HTTP2.
If you use these protocols in your application, you must call the application using the ingress gateway directly.
To do this you must find the ingress gateway's public address and the application's specific host.
.Procedure
. Find the application host. See the instructions in _Verifying your serverless application deployment_.
. Find the ingress gateway's public address:
+
[source,terminal]
----
$ oc -n knative-serving-ingress get svc kourier
----
+
.Example output
+
[source,terminal]
----
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kourier LoadBalancer 172.30.51.103 a83e86291bcdd11e993af02b7a65e514-33544245.us-east-1.elb.amazonaws.com 80:31380/TCP,443:31390/TCP 67m
----
+
The public address is surfaced in the `EXTERNAL-IP` field, and in this case is `a83e86291bcdd11e993af02b7a65e514-33544245.us-east-1.elb.amazonaws.com`.
. Manually set the host header of your HTTP request to the applications host, but direct the request itself against the public address of the ingress gateway.
+
[source,terminal]
----
$ curl -H "Host: hello-default.example.com" a83e86291bcdd11e993af02b7a65e514-33544245.us-east-1.elb.amazonaws.com
----
+
.Example output
[source,terminal]
----
Hello Serverless!
----
+
You can also make a gRPC request by setting the authority to the applications host, while directing the request against the ingress gateway directly:
+
[source,yaml]
----
grpc.Dial(
"a83e86291bcdd11e993af02b7a65e514-33544245.us-east-1.elb.amazonaws.com:80",
grpc.WithAuthority("hello-default.example.com:80"),
grpc.WithInsecure(),
)
----
+
[NOTE]
====
Ensure that you append the respective port, 80 by default, to both hosts as shown in the previous example.
====