For the complete documentation index, see llms.txt. This page is also available as Markdown.

Containers

Container blocks manage containerized applications and services. Facilitating the definition of container deployments, jobs, configurations, and associated Kubernetes resources like services, probes, and volumes.

Syntax

resource "name" {
  containers {
    [container_type] "[container_name]" {
      type = [k8s_resource_type]
      [attribute] = [value]
    }
  }
}

(Note: the "[container_type]" has no effect on functionality)

Defining Containers

Each container is defined by its type, name, and relevant attributes. Attributes vary based on the container type.

Common Attributes:

  • image: The container image to use.

  • type: The type of Kubernetes resource (e.g., Deployment, CronJob).

  • replicas: Number of pod replicas.

  • command/args: Commands and arguments to run inside the container.

  • resources: Resource limits and requests.

  • ports: Port configurations.

  • service: Service-related settings.

  • auto_scaling: Defines auto-scaling parameters.

  • node_selector: Specifies node selection criteria.

Auto Scaling

Defines the auto-scaling behavior for container deployments based on CPU utilization or other metrics.

Attributes:

  • min_replicas: Minimum number of replicas.

  • max_replicas: Maximum number of replicas.

  • target_cpu_utilization_percentage: Target CPU usage for scaling.

Services

Configures Kubernetes Services to expose containers. Supports different service types like LoadBalancer, ClusterIP, etc.

Attributes:

  • type: Type of service (e.g., LoadBalancer, ClusterIP).

  • annotations: Key-value pairs for service annotations.

  • ports: Port configurations for the service.

Probes and Resources

  • readiness_probe: Defines how Kubernetes determines if a container is ready to receive traffic.

  • resources: Sets resource limits and requests for containers.

Example

Last updated