This section provides information about various tasks that can be performed once you have successfully created a serverless application.

Verifying your serverless application deployment

To verify that your serverless application has been deployed successfully, you must get the application host created by Knative, and then send a request to that host and observe the output.

If you changed the application name from helloworld-go to a new name when creating the service.yaml file, replace helloworld-go in the commands with the new name you created.
Procedure
  1. Find the application host.

    oc get ksvc helloworld-go
    NAME            URL                                        LATESTCREATED         LATESTREADY           READY   REASON
    helloworld-go   http://helloworld-go.default.example.com   helloworld-go-4wsd2   helloworld-go-4wsd2   True
  2. Make a request to your cluster and observe the output.

    $ curl http://helloworld-go.default.example.com
    Hello World: Go Sample v1!

Interacting with a serverless application using HTTP2 / gRPC

OpenShift Container Platform routes do not support HTTP2, and therefore do not support gRPC as this 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
  1. Find the application host. See the instructions in Verifying your serverless application deployment.

  2. The ingress gateway’s public address can be determined using this command:

    oc -n istio-system get svc istio-ingressgateway

    The output will be similar to this example:

    NAME                   TYPE           CLUSTER-IP      EXTERNAL-IP                                                             PORT(S)                                                                                                                                      AGE
    istio-ingressgateway   LoadBalancer   172.30.51.103   a83e86291bcdd11e993af02b7a65e514-33544245.us-east-1.elb.amazonaws.com   80:31380/TCP,443:31390/TCP,31400:31400/TCP,15029:30672/TCP,15030:30970/TCP,15031:32657/TCP,15032:32400/TCP,15443:30167/TCP,15020:32285/TCP   67m

    The public address is surfaced in the EXTERNAL-IP field, and in this case would be:

    a83e86291bcdd11e993af02b7a65e514-33544245.us-east-1.elb.amazonaws.com
  3. Manually set the host header of your HTTP request to the application’s host, but direct the request itself against the public address of the ingress gateway.

    Here is an example, using the information obtained from the steps in Verifying your serverless application deployment:

    $ curl -H "Host: helloworld-go.default.example.com" a83e86291bcdd11e993af02b7a65e514-33544245.us-east-1.elb.amazonaws.com
    Hello Go Sample v1!

    You can also make a gRPC request by setting the authority to the application’s host, while directing the request against the ingress gateway directly.

    Here is an example of what that looks like in the Golang gRPC client:

    Ensure that you append the respective port (80 by default) to both hosts as shown in the example.

    grpc.Dial(
        "a83e86291bcdd11e993af02b7a65e514-33544245.us-east-1.elb.amazonaws.com:80",
        grpc.WithAuthority("helloworld-go.default.example.com:80"),
        grpc.WithInsecure(),
    )