Replace Deprecated kestra CLI Commands with kestractl
For the complete documentation index, see llms.txt. For a full content snapshot, see llms-full.txt. Append.mdto anykestra.io/docs/*URL for plain Markdown.
Available on: Open Source EditionEnterprise Edition
Seven kestra server CLI commands are deprecated in 2.1.0 and will be removed in a future release. Each one now has an equivalent in kestractl, the API client CLI.
The deprecated commands still work. Each one prints a deprecation message before it runs:
This command is deprecated and will be removed in a future version. Please use kestractl instead (https://kestra.io/docs/kestra-cli/kestractl).The message is printed to standard output. If a script captures the output of a deprecated command, such as TOKEN=$(kestra workers registration-tokens generate), the captured value now includes this line. Switch the script to kestractl to get clean output.
Command mapping
| Deprecated command | Edition | Replacement |
|---|---|---|
kestra flow export | OSS, EE | kestractl flows export |
kestra flow delete | OSS, EE | kestractl flows delete |
kestra namespace kv update | OSS, EE | kestractl kv set |
kestra auths users create | EE | kestractl users create |
kestra auths users create-basic-auth | EE | kestractl users set-password |
kestra tenants create | EE | kestractl tenants create |
kestra workers registration-tokens generate | EE | kestractl workers registration-tokens generate |
Most kestractl commands call the Kestra API, so they need a running instance and an authenticated context. kestractl workers registration-tokens generate is the exception: it runs offline.
Differences to account for
The replacements are not always drop-in. Check the following before updating scripts.
flow export
The two commands select flows differently:
kestra flow export --namespace my.namespaceexports flows inmy.namespaceand all of its child namespaces.--namespaceis required.kestractl flows export --namespace my.namespaceexports flows inmy.namespaceonly.--namespaceis optional, and omitting it exports every flow in the tenant.
To keep child namespaces in the export, use kestractl flows export-by-query with a PREFIX filter. kestra flow export also takes a directory and writes flows.zip into it, while kestractl takes the output file path:
# Beforekestra flow export --namespace my.namespace /path/to/export-directory
# After: my.namespace and its child namespaceskestractl flows export-by-query --filter NAMESPACE:PREFIX:my.namespace --output-file /path/to/export-directory/flows.zip
# After: my.namespace onlykestractl flows export --namespace my.namespace --output-file /path/to/export-directory/flows.zipnamespace kv update
kestra namespace kv update creates the key if it does not exist. Use kestractl kv set, which has the same behavior. kestractl kv update fails when the key does not exist.
kestractl kv set takes the value type as a required argument, and the TTL is an ISO 8601 duration passed with --ttl:
# Beforekestra namespace kv update my.namespace my-key "my-value" -e 1d
# Afterkestractl kv set my.namespace STRING my-key "my-value" --ttl P1Dauths users create
kestractl users create identifies the user with --email and sets the password with --user-password. Do not use --password, which authenticates kestractl itself.
The --instance-owner flag maps to --superadmin in kestractl. To grant the Admin role in a tenant, which --admin did, create a binding after you create the user:
# Beforekestra auths users create --tenant=main --admin alice@example.com 'S3cret!'
# Afterkestractl users create --email alice@example.com --user-password 'S3cret!'kestractl bindings create --tenant main --type USER --external-id <user_id> --role <admin_role_id>Run kestractl roles list --tenant main to find the Admin role ID.
kestractl needs an existing user to authenticate, so it can’t create the first user on a new instance. Create the first Instance Owner with the setup wizard or the kestra.security.instance-owner configuration.
tenants create
kestractl tenants create grants you, the authenticated user, the Admin role in the new tenant. kestra tenants create --admin-username granted it to the user you named. To make someone else the tenant admin, create a binding after the tenant exists:
# Beforekestra tenants create stage "Staging" --admin-username alice
# Afterkestractl tenants create stage --name "Staging"kestractl bindings create --tenant stage --type USER --external-id <user_id> --role <admin_role_id>kestractl users set-password and kestractl bindings create take a user ID, not a username. Run kestractl users list --query <username> to find it.
Related
Was this page helpful?