4장. Configuring OpenShift Serverless applications


4.1. Multi-container support for Serving

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.

4.1.1. 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.

4.1.2. Probing a multi-container service

You can specify readiness and liveness probes for multiple containers. This feature is not enabled by default and you must configure it using the KnativeServing custom resource (CR).

Procedure

  1. Configure multi-container probing for your service by enabling the multi-container-probing feature in the KnativeServing CR.

    Multi-container probing configuration

    ...
    spec:
      config:
        features:
          "multi-container-probing": enabled 
    1
    
    ...

    1
    Enabled multi-container-probing feature
  2. Apply the updated KnativeServing CR.

    $ oc apply -f <filename>
  3. Modify your multi-container service to include the specified probes.

    Multi-container probing

    apiVersion: serving.knative.dev/v1
    kind: Service
    ...
    spec:
     template:
       spec:
         containers:
           - name: first-container
             image: ghcr.io/knative/helloworld-go:latest
             ports:
               - containerPort: 8080
             readinessProbe: 
    1
    
               httpGet:
                 port: 8080
           - name: second-container
             image: gcr.io/knative-samples/helloworld-java
             readinessProbe: 
    2
    
               httpGet:
                 port: 8090

    1
    Readiness probe of the first container
    2
    Readiness probe of the second container

4.1.2.1. Additional resources

Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 문서 정보

Legal Notice

Theme

© 2026 Red Hat
맨 위로 이동