Managing services

Once you have created a Kalix project, use the Kalix Console or the kalix CLI to deploy container images.

Kalix services are automatically fault-tolerant and highly available. When you deploy a service, Kalix creates multiple service instances. When the service load increases, Kalix automatically scales up by adding more instances, and when the load decreases, it automatically scales down.

Deploy

A service can be deployed either by describing it with command line arguments, or using a service descriptor. Describing a service with command line arguments is more convenient for simple configurations to get started, while using a descriptor is useful because the descriptor can be checked into version control and re-used to ensure repeatable deployments.

Describing a service with command line arguments.

Assuming a service name of my-service, enter the following:

kalix service deploy \
    my-service \
    my-container-uri/container-name:tag-name

Describing a service with a descriptor

A Kalix service can also be described using a YAML descriptor. For example:

name: my-service
spec:
  image: my-container-uri/container-name:tag-name
  env:
  - name: SOME_VARIABLE
    value: some value

This can then be created by running:

kalix service apply -f my-service.yaml

You can also export the descriptor for an existing service by running:

kalix service export my-service -f my-service.yaml

For a complete reference of the Kalix service descriptor, see the Kalix service descriptor reference.

Verify service status

To verify the status of a service:

Console

From the Dashboard, the Services card displays the Status of all services in a project:

Services card
CLI

Use the following command:

kalix service list

A service status can be one of the following:

  • Ready: All service instances are up to date and fully available.

  • UpdateInProgress: Service is updating.

  • Unavailable: No service instances are available.

  • PartiallyReady: Some, but not all, service instances are available.

Update a deployed service

First, package and tag the changes to your service. When you redeploy, Kalix performs a rolling update.

To re-deploy:

CLI with command line arguments
  • Update the deployed my-service service with a new package tagged tag-name-2:

    kalix service deploy \
        my-service \
        my-container-uri/container-name:tag-name-2
CLI with a descriptor
  • After editing my-service.yaml:

    kalix service apply -f my-service.yaml

Removing a deployed service

Remove a deployed service using the CLI delete command. The following example removes a deployed service, where my-service is the service name:

kalix service delete my-service