All Products
Search
Document Center

Enterprise Distributed Application Service:Configure sidecar containers and init containers

Last Updated:Feb 29, 2024

This topic describes how to configure sidecar containers and init containers for an application when you create or deploy the application.

Terms

  • sidecar container

    Works with an application container and provides the log collection and traffic hijacking capabilities for the application container. A sidecar container shares storage and network resources with an application container. This way, the sidecar container can directly communicate with the application container.

  • init container

    Prepare resources and executes special scripts for an application container. Init containers are a set of special containers. Multiple init containers are executed in sequence. Application containers start only if all init containers are executed. For more information, see Init Containers.

Procedure

  1. Log on to the EDAS console.

  2. In the left-side navigation pane, choose Application Management > Applications. In the top navigation bar, select a region. In the upper part of the Applications page, select a microservices namespace from the Microservices Namespace drop-down list.

  3. On the Applications page, click Create Application.

  4. In the Basic Information step, specify Cluster Type and Application Runtime Environment and click Next. The following table describes the parameters.

    Parameter

    Description

    Cluster Type

    The type of the cluster in which you want to deploy the application. Select Kubernetes Clusters.

    Application Runtime Environment

    The application runtime environment. Select an application runtime environment based on the type of the hosted application.

    • Java

      • Custom: Select this option if you want to use a custom image to deploy the application in a Kubernetes cluster.

      • Java: Select this option if you want to use a universal JAR package to deploy the application as a Dubbo or a Spring Boot application. You can set the Java Environment parameter after you select this option.

      • Tomcat: Select this option if you want to use a universal WAR package to deploy the application as a Dubbo or a Spring application. You can set the Java Environment and Container Version parameters after you select this option.

      • EDAS-Container (HSF): Select this option if you want to use a WAR or FatJar package to deploy the application as a High-speed Service Framework (HSF) application. You can set the Java Environment, Pandora Version, and Ali-Tomcat Version parameters after you select this option.

    • PHP: Select this option if the application is a PHP application that runs on Apache HTTP Server.

    • Node.js, C++, Go, and Other Languages: Select this option if you want to use a custom image to deploy the application in a Kubernetes cluster. The configuration process for multi-language applications is not described in this topic.

  5. In the Configurations step, configure the environment information, basic information, and deployment method for the application, set the related resource parameters, and then click Next.

  6. In the Advanced Settings step, click Configure sidecars and InitContainers, configure the parameters based on your business requirements, and then click Next. The following table describes the parameters.

    Parameter

    Description

    Sidecar Container

    You can configure only one sidecar container in a single editor. If you want to configure multiple sidecar containers, click + Add Sidecar Containers.

    • The following sample code provides an example on how to mount a sidecar container to an application container to provide the BusyBox toolbox.

      name: busybox
      image: busybox:latest
      command: ["tail","-f" ,"/dev/null"]
    • For information about how to mount a sidecar container to an application to collect logs by using Logtail, see Use CRDs to collect container text logs in Sidecar mode.

    Init Container

    You can configure only one init container in a single editor. If you want to configure multiple init containers, click + Add Init Container.

    The following sample code provides an example on how to configure an init container that sleeps for 60 seconds before the application container starts.

    name: busybox
    image: busybox:latest
    command: ["sleep", "60"]
  7. Click Create Application.

  8. In the Creation Completed step, check the information in the Basic Information, Configurations, and Advanced Settings sections, and then click Create Application.

    At the top of the Basic information page, click View Details. You can view the change process on the Change Details page. Wait several minutes until the application is deployed. Then, check the instance status on the Instance Information tab of the Basic information page. If the instance is in the Normal state, the application is deployed.