Advanced configuration

更新时间:
复制 MD 格式

You can set the following advanced configuration options for the pod template when you create an application service.

Environment variables

You can configure environment variables for a pod as key-value pairs. This lets you add environment flags or pass configuration settings to the pod. The variables are passed to the application process when the container starts. For example: USER=tester. For more information, see Pod variable.

The parameters are described as follows:

  • Source:

    • Manual Entry: Manually specify the name and value of the environment variable.

    • ConfigMap: Select a ConfigMap to specify the value of the environment variable.

    • Secret: Select a secret to specify the value of the environment variable.

  • Variable Name: The name of the environment variable.

  • Value/Reference:

    • If you select Manual Entry, this is the value of the environment variable.

    • If you select ConfigMap or Secret, this is the reference to the ConfigMap or secret.

Volume configuration

You can configure data volumes for the container. Currently, you can only mount directories from the container's host.

The parameters are described as follows:

  • Type: Supported types include Local Storage, ConfigMap, and Secret. For more information, see volumes.

  • Permissions: Supported permissions include Read/Write or Read-only.

  • Container Path: The path to the data volume in the container.

  • Host Path/Reference:

    • If you select Local Storage, this is the directory on the pod's host.

    • If you select ConfigMap or Secret, this is the corresponding reference.

Health check configuration

A health check periodically checks the health of a container based on your configuration. If you do not configure a health check, the container cannot detect application exceptions and will not automatically restart to recover. This can disrupt your service.

AKS provides two types of health checks: Readiness Probes and Liveness Probes.

A Readiness Probe determines whether a container is ready to accept traffic. If the probe fails, the cluster stops sending traffic to the container. If the probe succeeds, the cluster resumes sending traffic to the container.

A Liveness Probe determines whether a container is running. If the probe fails, the cluster restarts the container.

Note

Readiness and Liveness Probes are native Kubernetes concepts. For more information, see Kubernetes Probes.

  • Configure Readiness Probe

    The parameters are described as follows:

    • Check Method:

      • TCP Socket Port: Sends a TCP request. The probe is considered successful if a connection is established.

        • Port: The container port to access over TCP.

      • HTTP GET Method: Sends an HTTP GET request. The probe is considered successful if the returned status code is between 200 and 399, inclusive.

        • Path: The access path for the HTTP request.

        • Port: The container port for the HTTP request. The range is 1 to 65535.

      • Execute Command in Container: Executes a command in the container. The probe is considered successful if the command returns an exit code of 0.

        • Command: The command to execute in the container.

    • Initial Delay: The number of seconds to wait after the container starts before the first probe is initiated. This corresponds to `initialDelaySeconds`. The default value is 5 seconds.

    • Timeout: The number of seconds after which the probe times out. This corresponds to `timeoutSeconds`. The default value is 1 second, and the minimum value is 1 second.

    • Interval: The frequency, in seconds, at which to perform the probe. This corresponds to `periodSeconds`. The default value is 10 seconds, and the minimum value is 1 second.

    • Healthy Threshold: The minimum number of consecutive successes required for the probe to be considered successful after a failure. The default value is 1, and the minimum value is 1.

    • Unhealthy Threshold: The minimum number of consecutive failures required for the probe to be considered failed after a success. The default value is 3, and the minimum value is 1.

  • Configure Liveness Probe

    The parameters are described as follows:

    • Check Method:

      • TCP Socket Port: Sends a TCP request. The probe is considered successful if a connection is established.

        • Port: The container port to access over TCP.

      • HTTP GET Method: Sends an HTTP GET request. The probe is considered successful if the returned status code is between 200 and 399, inclusive.

        • Path: The access path for the HTTP request.

        • Port: The container port for the HTTP request. The range is 1 to 65535.

      • Execute Command in Container: Executes a command in the container. The probe is considered successful if the command returns an exit code of 0.

        • Command: The command to execute in the container.

    • Initial Delay: The number of seconds to wait after the container starts before the first probe is initiated. This corresponds to `initialDelaySeconds`. The default value is 5 seconds.

    • Timeout: The number of seconds after which the probe times out. This corresponds to `timeoutSeconds`. The default value is 1 second, and the minimum value is 1 second.

    • Interval: The frequency, in seconds, at which to perform the probe. This corresponds to `periodSeconds`. The default value is 10 seconds, and the minimum value is 1 second.

    • Healthy Threshold: The minimum number of consecutive successes required for the probe to be considered successful after a failure. The default value is 1, and the minimum value is 1.

    • Unhealthy Threshold: The minimum number of consecutive failures required for the probe to be considered failed after a success. The default value is 3, and the minimum value is 1.

Lifecycle event callback configuration

You can add lifecycle event callbacks for a container. These callbacks are executed after the container starts and before it stops.

The available lifecycle callbacks are Post Start, which is triggered after the container starts, and Pre Stop, which is triggered before the container stops.

The parameters are described as follows:

  • Configure Post Start:

    Callback Method: Supported methods include Execute Command in Container (requires a command, such as cat tmp/healthy) and HTTP GET Method (requires a path, such as /healthy/readiness, and a port from 1 to 65535).

  • Configure Pre Stop:

    Callback Method: Supported methods include Execute Command in Container (requires a command, such as cat tmp/healthy) and HTTP GET Method (requires a path, such as /healthy/liveness, and a port from 1 to 65535).

Log service configuration

You can configure Alibaba Cloud Simple Log Service (SLS) by selecting an existing Logstore or creating a new one.

The parameters are described as follows:

  • Logstore: Select from existing Logstores. If no Logstores are available, click Create Logstore to create a new one.

  • Log Type: Container text log.

  • Path: The path in the container from which logs are collected. For example: /home/admin/*.log or /root/*.log.

Business real-time monitoring

You can add a monitoring directory to view the container's monitoring data on the application service details page. The monitoring application reads the content from this directory.

The parameters are described as follows:

Monitoring Directory: The output directory for application monitoring logs that the application needs to collect.