---
title: Charmhub | Deploy Temporal Server using Charmhub - The Open Operator Collection
description: Deploy the latest version of Temporal Server as a Kubernetes Operator
  on any cloud.
url: https://charmhub.io/temporal-k8s/docs/t-run-workflow
---

# Temporal Server

[Workflows Charmers](https://charmhub.io/publisher/workflows-charmers "View all packages from Workflows Charmers")

* [Workflows Charmers](https://charmhub.io/publisher/workflows-charmers "View all packages from Workflows Charmers")

Platform:

1.23/stable 60

```
juju deploy temporal-k8s --channel 1.23/stable
```

[Learn to deploy on juju >](https://juju.is/docs/juju/manage-applications)

---

#### Relevant links

* [Homepage](https://github.com/canonical/temporal-k8s-operator)

---

#### Contacts

##### Maintainers

+ [Commercial Systems](mailto:jaas-crew@lists.canonical.com)

* [Submit a bug](https://github.com/canonical/temporal-k8s-operator/issues)

---

Share your thoughts on this charm with the community on discourse.

[Join the discussion](https://discourse.charmhub.io/)

# Run Your First Workflow

This is part of the
[Charmed Temporal Tutorial](https://charmhub.io/temporal-k8s/docs/t-introduction).
Please refer to this page for more information and the overview of the content.

Now that you have a Temporal Server up and running with a Temporal Worker
connected to it, you will trigger a workflow execution and observe its result in
the Web UI.

This tutorial uses the `GreetingWorkflow` workflow type registered by the [`resource_sample_py`](https://github.com/canonical/temporal-worker-k8s-operator/tree/main/resource_sample_py) sample worker image. If you used a different worker image, substitute the matching workflow type. Other workflow types registered by the sample image include `VaultWorkflow` and `DatabaseWorkflow`.

You can trigger a workflow either via the Temporal Python SDK (option A) or via the admin charm’s `cli` action (option B).

## [Option A: trigger via the Python SDK](https://charmhub.io/temporal-k8s/docs/t-run-workflow#p-27506-option-a-trigger-via-the-python-sdk)

1. Create a client to trigger the workflow as defined in the worker. For instance, using the Canonical [`temporal-lib-py`](https://pypi.org/project/temporal-lib-py/) wrapper:

```
from temporallib.client import Client, Options
import asyncio

async def main():
    client_opt = Options(
        host="temporal-k8s.<model>.svc.cluster.local:7233",
        queue="your-queue",
        namespace="your-namespace",
    )

    client = await Client.connect(client_opt=client_opt)

    greeting = await client.execute_workflow(
        "GreetingWorkflow",
        "world",                     # workflow input (the name to greet)
        id="hello-1",
        task_queue="your-queue",
    )

    print(greeting)

if __name__ == "__main__":
    asyncio.run(main())
```

Replace:

* `<model>` with the Juju model name where `temporal-k8s` is deployed.
* `your-queue` and `your-namespace` with the values you set in the [Deploy Temporal Admin](https://charmhub.io/temporal-k8s/docs/t-deploy-admin) and [Deploy Temporal Worker](https://charmhub.io/temporal-k8s/docs/t-deploy-worker) steps.

1. Install the necessary packages and run the script as follows:

```
pip install temporal-lib-py

python workflow.py
```

## [Option B: trigger via the admin charm’s `cli` action](https://charmhub.io/temporal-k8s/docs/t-run-workflow#p-27506-option-b-trigger-via-the-admin-charms-cli-action)

If you do not want to write Python, the admin charm exposes a `cli` action that wraps the modern [`temporal` CLI](https://docs.temporal.io/cli):

```
juju run temporal-admin-k8s/0 cli args="workflow start \
  --type GreetingWorkflow \
  --task-queue your-queue \
  --workflow-id hello-1 \
  --input '\"world\"' \
  --namespace your-namespace" --wait 1m
```

Verify the result:

```
juju run temporal-admin-k8s/0 cli args="workflow show \
  --workflow-id hello-1 \
  --namespace your-namespace" --wait 1m
```

You should see the workflow’s full event history ending in `WorkflowExecutionCompleted` with status `COMPLETED`.

## [View the workflow in the Web UI](https://charmhub.io/temporal-k8s/docs/t-run-workflow#p-27506-view-the-workflow-in-the-web-ui)

Further details on the workflow execution can be viewed on the [Temporal Web UI](https://charmhub.io/temporal-k8s/docs/t-deploy-ui) you deployed earlier. Look up the workflow by ID (`hello-1` in the examples above) to see its event history, input, output, and timing.

Workflow and activity payloads can be encrypted by setting the same key in
the `auth-secret-id` config of the Temporal worker and the Client configurations
provided by the various Temporal SDKs.
See [`auth-secret-id`](https://charmhub.io/temporal-worker-k8s/configurations#auth-secret-id) for details.

If TLS termination on ingress is configured, you must also provide the Certificate Authority (CA) to the client.
See [Temporal SDKs](https://docs.temporal.io/develop/) for configuration details.

> **See next: [Cleanup your environment](https://charmhub.io/temporal-k8s/docs/t-cleanup)**

---
