Knative: Operator’s Handbook

HTTP/2

Knative supports end-to-end HTTP/2 for applications that can work with HTTP/2. (This is also how gRPC is supported on Knative.)

However, currently 1 you need to explicitly mark your container port as h2c (unencrypted form of HTTP/2) by specifying a custom port on KService:

apiVersion: serving.knative.dev/v1alpha1
kind: Service
metadata:
  name: hello
spec:
  template:
    spec:
      containers:
      - image: gcr.io/google-samples/hello-app:1.0
        ports:
        - name: h2c
          containerPort: 8080

The application will be executed with PORT environment value set to 8080.

In this mode, the traffic between the load balancer and the Pod will be unencrypted.


  1. Knative runtime contract suggests protocol should be auto-detected, however until this issue is resolved, this step is required. ↩︎