Skip to content

Run a Container Service

Call function.run(action="serve", ...) to deploy the container as a service. Pass service and execution parameters as keyword arguments to the same call.

Parameters

Name Type Required Description
action str ✓ Action to execute. Must be serve
volumes list[dict] List of volumes.
resources dict Resource values with optional cpu, mem, gpu and disk keys. Example: {"cpu": "1", "mem": "512Mi"}.
envs list[dict] Environment variables. Example: [{"name": "FOO", "value": "bar"}].
secrets list[str] List of secret names.
profile str Profile template.
replicas int Number of replicas. Must be non-negative.
service_ports list[dict] Ports to expose for the service. Each port and target port must be an integer. Example: [{"port": 80, "target_port": 8080}].
service_type str Service type: ClusterIP, LoadBalancer, NodePort or ExternalName.
service_name str Service name.
run_as_user int User ID to run the container. Must be non-negative.
run_as_group int Group ID to run the container. Must be non-negative.
fs_group int File system group ID. Must be positive.
args list[str] Command-line arguments to pass to the container command.

Example

run = function.run(
    action="serve",
    replicas=3,
    service_ports=[{"port": 80, "target_port": 8080}]
)