# Kubernetes

{% stepper %}
{% step %}

### Download Template Files

{% embed url="<https://gitlab.com/obsidian.systems/tradecraft-docs>" %}

`git clone https://gitlab.com/obsidian.systems/tradecraft-docs.git`
{% endstep %}

{% step %}

### Create ConfigMaps&#x20;

Modify these 3 files with the proper values for your setup:

* `tradecraft-config.yaml`&#x20;
* `tradecraft-ui-common-config.yaml`&#x20;
* `tradecraft-ui-backend-config.yaml`&#x20;

Suggested considerations:

* [ ] Replace the OAuth URL as necessary in all three files.
* [ ] tradecraft-config.yaml:
  * [ ] Use the correct `network` , either  `devnet` , `testnet`  or  `mainnet`&#x20;
* [ ] Put the password for the `tradecraft` OAuth user in `tradecraft-secret.yaml`&#x20;

{% tabs %}
{% tab title="Keycloak" %}
... specific instructions coming soon.
{% endtab %}

{% tab title="auth0" %}

* [ ] tradecraft-config.yaml:
  * [ ] Set the `oauth` `username` to the email address used during auth0 setup.
  * [ ] Set the `oauth` `url` to `https://your-tenant-id.us.auth0.com/oauth/token`&#x20;
  * [ ] Add a line under `extra_params` for: `"audience": "https://canton.network.global"`
  * [ ] Set the `client_id`  using the ID found in the auth0 dashboard on the page for the Tradecraft application settings.
* [ ] tradecraft-ui-backend-config.yaml:
  * [ ] Set `oauth_request_url` to `https://your-tenant-id.us.auth0.com/oauth/token`
* [ ] tradecraft-ui-common-config.yaml:

  * [ ] Set `oauth_auth_url` to `https://your-tenant-id.us.auth0.com/authorize`
  * [ ] Set `oauth_client_id` using the same value as above.

  You can find your Client ID here:\ <img src="/files/w1fiJqdJJIDCXDIAslsV" alt="" data-size="original">
  {% endtab %}
  {% endtabs %}

The config files can reference environment variables which you’ll likely want to supply through Kubernetes secrets, like so:

```bash
kubectl apply -f tradecraft-secret.yaml
```

Now go ahead and create the ConfigMaps on Kubernetes:

<pre class="language-bash"><code class="lang-bash"><strong>kubectl apply -f tradecraft-config.yaml
</strong>kubectl apply -f tradecraft-ui-common-config.yaml
kubectl apply -f tradecraft-ui-backend-config.yaml
</code></pre>

{% endstep %}

{% step %}

### Create Deployment

Create a Deployment to start the Tradecraft containers:

```bash
kubectl apply -f tradecraft-deployment.yaml
```

{% endstep %}

{% step %}

### Create Service

To expose the deployment on the host we need a Service:

```bash
kubectl apply -f tradecraft-service.yaml
```

{% endstep %}

{% step %}

### Create Ingress

Finally, depending on how you expose things to the web, you probably need an Ingress. For example, if you use Traefik:

```bash
kubectl apply -f tradecraft-ingress.yaml
```

{% endstep %}
{% endstepper %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tradecraft.fi/app-documentation/installation/images-and-media/kubernetes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
