This section describes how to build artifacts into container images (B2I).

After the image builder starts running, it will automatically perform the following operations:

  1. Use the image builder to build the user-uploaded artifact files into container images.

  2. Push the container image to the user-specified image service.

Example Artifacts

The following are some example artifacts for demonstration and testing:

Artifact Package GitHub Repository

Prerequisites

  • You need to join a project and have the Application Workload Management permission in the project. For more information, see Project Members and Project Roles.

  • You need to prepare the artifact files for building the image in advance. KubeSphere supports artifact files in JAR, WAR, and binary formats by default.

  • You need to have an available container image service to store the container images generated from the build. For more information, refer to the Docker official documentation.

  • You need to create a secret in the project in advance to store the image service information. For more information, refer to Create a Secret.

Steps

  1. Log in to the KubeSphere web console with a user who has Application Workload Management permissions and enter your workspace.

  2. Click Image Builder in the left navigation pane.

  3. Select a project from the drop-down list in the upper left corner of the page.

  4. Click Create on the page.

  5. On the Build Mode tab, select JAR, WAR, or Binary based on the type of the artifact file, and then click Next.

  6. On the Build Settings tab, configure the build environment, artifact file, and image service information, and then click Create.

    Parameter Description

    Artifact Files

    Upload artifact files locally to build the image.

    Build Environment

    The build environment for the container image. Please select the build environment based on the format and version of the artifact file.

    Image Name

    The name of the target container image to be built. The name can only contain lowercase letters, numbers, hyphens (-), periods (.), slashes (/), and colons (:), and must start and end with a lowercase letter or number.

    The image name should include the image’s namespace, for example, my-namespace/my-image. If no namespace is entered, the system will automatically add the namespace library, and the actual image name will be library/my-image.

    Image Tag

    The tag of the target container image to be built.

    Target Image Service

    The image service used to store the target image. Please select a Secret containing the image service information.

    Trigger Token

    The authentication token used by the client to trigger KubeSphere image builds via webhook. If a token is set, requests must provide the correct token to trigger the image build. The token can only contain uppercase letters, lowercase letters, and numbers.

    After the service is created, KubeSphere will create the image builder and provide a URL that can be used by third-party applications to trigger image builds. You can obtain the URL on the details page of the image builder.

    Environment Variables

    Environment variables for the image runtime, used to control the behavior of the image during runtime.

    • For more information about JAR build environment variables, please visit the s2i-java-container repository.

    • For more information about WAR build environment variables, please refer to the s2i-java-container repository.

    • For more information about binary build environment variables, please refer to the s2i-binary-container repository.

    After the image builder is created, it will be displayed in the image builder list.