> For the complete documentation index, see [llms.txt](https://chsakell.gitbook.io/harmony/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://chsakell.gitbook.io/harmony/configuration/docker/kubernetes.md).

# Kubernetes

Harmony can be deployed on a [Kubernetes](https://kubernetes.io/) cluster with just a single command. What Kubernetes *(k8s)* allows you to do is to seamlessly automate deploying,  scaling, auto-healing your services and much more.&#x20;

The files existing in the source code are tested for a **local** Kubernetes cluster, ideally being created using the [Docker Desktop](https://www.docker.com/products/docker-desktop/) app. You can test scaling deployment replicas or auto healing features by runing <mark style="color:orange;">kubectl</mark> commands on your machine.

For production deployment, feel free to make any modifications to match your environment.

Here's the prerequisites to deploy Harmony in a local Kubernetes cluster:

* [x] You have installed and enabled **Kubernetes** on your local machine.
* [x] You have [kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl) tool installed.
* [x] You have configured a development certificate as described [here](https://docs.harmony-teams.com/overview/setup/docker#create-and-trust-a-development-certificate).

#### Create a config map for the development certificate

When you configured a development certificate, a **harmony.pfx** file has been created at <mark style="color:orange;">$env:USERPROFILE\\.aspnet\https\\</mark> folder on your machine. Run the following command to create a k8s [config map](https://kubernetes.io/docs/concepts/configuration/configmap/).

```docker
kubectl create configmap cert-config-map --from-file <your-path-here>\harmony.pfx
```

Replace the *\<your-path-here>* with your own path coming from **$env:USERPROFILE\\.aspnet\https\\**. For example:

```
kubectl create configmap cert-config-map --from-file C:\Users\chsakell\.aspnet\https\harmony.pfx
```

{% hint style="info" %}
The config map will make **harmony.pfx** file available on your cluster.
{% endhint %}

#### Create Harmony images

Open a terminal and navigate at the root of Harmony's solution where the *docker-compose.yml* file exists and run the following command to create the docker images:

```docker
docker compose build
```

#### Deploy pods on Kubernetes cluster

Open a terminal and navigate at the root of Harmony's solution where a **.k8s** folder exists. Run the following command to deploy harmony on your local Kubernetes:

```docker
k create -f .\.k8s\
```

{% hint style="info" %}
The command creates all Kubernetes deployments and services existing inside the **.k8s** folder
{% endhint %}

Harmony should be up and running at <http://localhost:7096/>

{% embed url="<https://youtu.be/kWQrQri5Dxs>" %}
Harmony on Kubernetes
{% endembed %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://chsakell.gitbook.io/harmony/configuration/docker/kubernetes.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
