|
| 1 | +# Layered Solution: Helm Charts and Kubernetes |
| 2 | + |
| 3 | +````json |
| 4 | +//[doc-nav] |
| 5 | +{ |
| 6 | + "Previous": { |
| 7 | + "Name": "CORS configuration", |
| 8 | + "Path": "solution-templates/layered-web-application/cors-configuration" |
| 9 | + } |
| 10 | +} |
| 11 | +```` |
| 12 | + |
| 13 | +> You must have an ABP Business or a higher license to be able to use the Kubernetes features. |
| 14 | +
|
| 15 | +This document explains how to deploy the layered solution to a Kubernetes cluster using [Helm](https://helm.sh/) charts. The layered solution template includes Helm charts for each application and infrastructure (Redis, RabbitMQ, etc). You can use these charts to deploy the solution to a Kubernetes cluster. You can see the Helm charts in the `etc/helm` folder of the solution. |
| 16 | + |
| 17 | +## Folder Structure |
| 18 | + |
| 19 | +The folder structure of the Helm charts is as follows: |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | +> You might have different charts based on the solution template options you selected while creating the solution. |
| 24 | +
|
| 25 | +* **bookstore**: The Helm chart for the `Bookstore` solution. The folder name should be the same as your project name. |
| 26 | + * **charts**: The sub-charts of the solution. Each application and infrastructure has its own chart. |
| 27 | + * **templates**: The templates of the solution. It includes the ingress host URLs. |
| 28 | + * **Chart.yaml**: The chart metadata. |
| 29 | + * **values.bookstore-local.yaml**: The override values file for the [Kubernetes profile](../../studio/kubernetes.md#profile). It should follow the naming convention for your project name. |
| 30 | + * **values.yaml**: The default values file for the chart. |
| 31 | +* **build-all-images.ps1**: A PowerShell script to build all Docker images of the solution. |
| 32 | +* **build-image.ps1**: A PowerShell script to build a Docker image of a specified project. |
| 33 | +* **create-tls-secrets.ps1**: A PowerShell script to create local TLS secrets for the ingress controller. It's important when you try to [intercept a service](../../studio/kubernetes.md#intercept-a-service) and run it locally. |
| 34 | +* **install.ps1**: A PowerShell script to install the solution to a Kubernetes cluster. You can override the default argument values. |
| 35 | +* **uninstall.ps1**: A PowerShell script to uninstall the solution from a Kubernetes cluster. You can override the default argument values. |
| 36 | + |
| 37 | +## Installing the Helm Charts |
| 38 | + |
| 39 | +You can install the solution to a Kubernetes cluster using the `install.ps1` script. The script has the following arguments: |
| 40 | + |
| 41 | +* **ChartName**: Default value is the project name. You can create different charts and specify the chart name. In ABP Studio [Kubernetes Main Chart](../../studio/kubernetes.md#main-chart) *Install Chart(s)* command automatically sets the chart name. |
| 42 | +* **Namespace**: The namespace to install the Kubernetes resources. Default value is the project name with the `-local` suffix. |
| 43 | +* **ReleaseName**: The release name of the Helm chart. Default value is the project name with the `-local` suffix. |
| 44 | +* **DotnetEnvironment**: The environment to run the application. Default value is `Staging`. |
| 45 | +* **User**: The user responsible for installing the Kubernetes resources. The application will automatically set the user name if you configure it under [Specify the User](../../studio/kubernetes.md#specify-the-user). |
| 46 | + |
| 47 | +Before running the script, you need to build the Docker images of the solution. You can use the `build-all-images.ps1` script to build all Docker images of the solution. Afterwards, make sure that you have a Kubernetes TLS secret for the ingress controller. It is automatically created when you create the solution; however, if you clone the solution from a repository, you need to create it manually. You can use the `create-tls-secrets.ps1` script to create the TLS secret. Then you can run the `install.ps1` script to install the solution to a Kubernetes cluster. |
| 48 | + |
| 49 | +## Uninstalling the Helm Charts |
| 50 | + |
| 51 | +You can uninstall the solution from a Kubernetes cluster using the `uninstall.ps1` script. The script has the following arguments: |
| 52 | + |
| 53 | +* **Namespace**: The namespace to uninstall the helm chart. Default value is the project name with the `-local` suffix. |
| 54 | +* **ReleaseName**: The release name of the Helm chart. Default value is the project name with the `-local` suffix. |
| 55 | +* **User**: The user responsible for uninstalling the Kubernetes resources. The application will automatically set the user name if you configure it under [Specify the User](../../studio/kubernetes.md#specify-the-user). |
| 56 | + |
| 57 | +You can run the `uninstall.ps1` script to uninstall the solution from a Kubernetes cluster. |
| 58 | + |
| 59 | +```bash |
| 60 | +./uninstall.ps1 |
| 61 | +``` |
| 62 | + |
| 63 | +Additionally, in ABP Studio [Kubernetes](../../studio/kubernetes.md) feature, you can do the same operations more easily. You can use the Install Chart(s) and Uninstall Chart(s) commands to install and uninstall the solution to a Kubernetes cluster. Also, use the Build Docker Image(s) command to build the Docker images of the solution. |
| 64 | + |
| 65 | + |
0 commit comments