This is a cache of https://docs.openshift.com/serverless/1.30/knative-serving/config-applications/multi-container-support-for-serving.html. It is a snapshot of the page at 2024-11-29T16:59:17.076+0000.
Multi-container support - Configuring Serverless applications | Serving | Red Hat OpenShift Serverless 1.30
×

You can deploy a multi-container pod by using a single Knative service. This method is useful for separating application responsibilities into smaller, specialized parts.

Configuring a multi-container service

Multi-container support is enabled by default. You can create a multi-container pod by specifiying multiple containers in the service.

Procedure
  1. Modify your service to include additional containers. Only one container can handle requests, so specify ports for exactly one container. Here is an example configuration with two containers:

    Multiple containers configuration
    apiVersion: serving.knative.dev/v1
    kind: service
    ...
    spec:
      template:
        spec:
          containers:
            - name: first-container (1)
              image: gcr.io/knative-samples/helloworld-go
              ports:
                - containerPort: 8080 (2)
            - name: second-container (3)
              image: gcr.io/knative-samples/helloworld-java
    1 First container configuration.
    2 Port specification for the first container.
    3 Second container configuration.