|
| 1 | +--- |
| 2 | +title: Installation |
| 3 | +--- |
| 4 | + |
| 5 | +## Install with Helm |
| 6 | + |
| 7 | +If you have a Kubernetes cluster, Helm is the recommended installation method. |
| 8 | + |
| 9 | +The following tutorial will guide you to install Kusion using Helm, which will install the chart with the release name `kusion-release` in namespace `kusion`. |
| 10 | + |
| 11 | +### Prerequisites |
| 12 | + |
| 13 | +* Helm v3+ |
| 14 | +* A Kubernetes Cluster (The simplest way is to deploy a Kubernetes cluster locally using `kind` or `minikube`) |
| 15 | + |
| 16 | +### Installation Options |
| 17 | + |
| 18 | +> Note: A valid kubeconfig configuration is required for Kusion to function properly. You must either use the installation script, provide your own kubeconfig in values.yaml, or set it through the --set parameter |
| 19 | +
|
| 20 | +You have several options to install Kusion: |
| 21 | + |
| 22 | +#### 1. Using the installation script (recommended) |
| 23 | + |
| 24 | +Download the installation script from the [KusionStack charts repository](https://github.com/KusionStack/charts/blob/master/scripts/install-kusion.sh) |
| 25 | + |
| 26 | +```shell |
| 27 | +curl -O https://raw.githubusercontent.com/KusionStack/charts/master/scripts/install-kusion.sh |
| 28 | +chmod +x install-kusion.sh |
| 29 | +``` |
| 30 | + |
| 31 | +Run the installation script with your kubeconfig files: |
| 32 | + |
| 33 | +```shell |
| 34 | +./install-kusion-server.sh <kubeconfig_key1=kubeconfig_path1> <kubeconfig_key2=kubeconfig_path2> ... |
| 35 | +``` |
| 36 | + |
| 37 | +**Parameters:** |
| 38 | + |
| 39 | +- **kubeconfig_key**: The key for the kubeconfig file. It should be unique and not contain spaces. |
| 40 | + |
| 41 | +- **kubeconfig_path**: The path to the kubeconfig file. |
| 42 | + |
| 43 | +#### 2. Remote installation with Helm |
| 44 | + |
| 45 | +First, add the `kusionstack` chart repo to your local repository: |
| 46 | + |
| 47 | +```shell |
| 48 | +helm repo add kusionstack https://kusionstack.github.io/charts |
| 49 | +helm repo update |
| 50 | +``` |
| 51 | + |
| 52 | +Then install with your encoded kubeconfig: |
| 53 | + |
| 54 | +```shell |
| 55 | +# Base64 encode your kubeconfig files |
| 56 | +KUBECONFIG_CONTENT1=$(base64 -w 0 /path/to/your/kubeconfig1) |
| 57 | +KUBECONFIG_CONTENT2=$(base64 -w 0 /path/to/your/kubeconfig2) |
| 58 | + |
| 59 | +# Install with kubeconfig and optional configurations |
| 60 | +helm install kusion-release kusionstack/kusion \ |
| 61 | +--set kubeconfig.kubeConfigs.kubeconfig0="$KUBECONFIG_CONTENT1" \ |
| 62 | +--set kubeconfig.kubeConfigs.kubeconfig1="$KUBECONFIG_CONTENT2" |
| 63 | +``` |
| 64 | + |
| 65 | +You may have to set your specific configurations if it is deployed into a production cluster, or you want to customize the chart configuration, such as `database`, `replicas`, `port` etc. |
| 66 | + |
| 67 | +```shell |
| 68 | +helm install kusion-release kusionstack/kusion \ |
| 69 | +--set kubeconfig.kubeConfigs.kubeconfig0="$KUBECONFIG_CONTENT1" \ |
| 70 | +--set kubeconfig.kubeConfigs.kubeconfig1="$KUBECONFIG_CONTENT2" \ |
| 71 | +--set server.port=8080 \ |
| 72 | +--set server.replicas=3 \ |
| 73 | +--set mysql.enabled=true \ |
| 74 | +``` |
| 75 | + |
| 76 | +> All configurable parameters of the Kusion chart are detailed [here](#chart-parameters). |
| 77 | +
|
| 78 | +### Search all available versions |
| 79 | + |
| 80 | +You can use the following command to view all installable chart versions. |
| 81 | + |
| 82 | +```shell |
| 83 | +helm repo update |
| 84 | +helm search repo kusionstack/kusion --versions |
| 85 | +``` |
| 86 | + |
| 87 | +### Upgrade specified version |
| 88 | + |
| 89 | +You can specify the version to be upgraded through the `--version`. |
| 90 | + |
| 91 | +```shell |
| 92 | +# Upgrade to the latest version. |
| 93 | +helm upgrade kusion-release kusionstack/kusion |
| 94 | + |
| 95 | +# Upgrade to the specified version. |
| 96 | +helm upgrade kusion-release kusionstack/kusion --version 1.2.3 |
| 97 | +``` |
| 98 | + |
| 99 | +### Local Installation |
| 100 | + |
| 101 | +If you have problem connecting to [https://kusionstack.github.io/charts/](https://kusionstack.github.io/charts/) in production, you may need to manually download the chart from [here](https://github.com/KusionStack/charts) and use it to install or upgrade locally. |
| 102 | + |
| 103 | +```shell |
| 104 | +git clone https://github.com/KusionStack/charts.git |
| 105 | +``` |
| 106 | + |
| 107 | +Edit the [default template values](https://github.com/KusionStack/charts/blob/master/charts/kusion/values.yaml) file to set your own kubeconfig and other configurations. |
| 108 | +> For more information about the KubeConfig configuration, please refer to the [KubeConfig](#kubeconfig) section. |
| 109 | +
|
| 110 | +Then install the chart: |
| 111 | + |
| 112 | +```shell |
| 113 | +helm install kusion-release charts/kusion |
| 114 | +``` |
| 115 | + |
| 116 | +### Uninstall |
| 117 | + |
| 118 | +To uninstall/delete the `kusion-release` Helm release in namespace `kusion`: |
| 119 | + |
| 120 | +```shell |
| 121 | +helm uninstall kusion-release |
| 122 | +``` |
| 123 | + |
| 124 | +### Image Registry Proxy for China |
| 125 | + |
| 126 | +If you are in China and have problem to pull image from official DockerHub, you can use the registry proxy: |
| 127 | + |
| 128 | +```shell |
| 129 | +helm install kusion-release kusionstack/kusion --set registryProxy=docker.m.daocloud.io |
| 130 | +``` |
| 131 | + |
| 132 | +**NOTE**: The above is just an example, you can replace the value of `registryProxy` as needed. You also need to provide your own kubeconfig in values.yaml or set it through the --set parameter. |
| 133 | + |
| 134 | +## Chart Parameters |
| 135 | + |
| 136 | +The following table lists the configurable parameters of the chart and their default values. |
| 137 | + |
| 138 | +### General Parameters |
| 139 | + |
| 140 | +| Key | Type | Default | Description | |
| 141 | +|-----|------|---------|-------------| |
| 142 | +| namespace | string | `"kusion"` | Which namespace to be deployed | |
| 143 | +| namespaceEnabled | bool | `true` | Whether to generate namespace | |
| 144 | +| registryProxy | string | `""` | Image registry proxy will be the prefix as all component images | |
| 145 | + |
| 146 | +### Global Parameters |
| 147 | + |
| 148 | +| Key | Type | Default | Description | |
| 149 | +|-----|------|---------|-------------| |
| 150 | + |
| 151 | +### Kusion Server |
| 152 | + |
| 153 | +The Kusion Server Component is the main backend server that provides the core functionality and REST APIs. |
| 154 | + |
| 155 | +| Key | Type | Default | Description | |
| 156 | +|-----|------|---------|-------------| |
| 157 | +| server.args.authEnabled | bool | `false` | Whether to enable authentication | |
| 158 | +| server.args.authKeyType | string | `"RSA"` | Authentication key type | |
| 159 | +| server.args.authWhitelist | list | `[]` | Authentication whitelist | |
| 160 | +| server.args.autoMigrate | bool | `true` | Whether to enable automatic migration | |
| 161 | +| server.args.dbHost | string | `""` | Database host | |
| 162 | +| server.args.dbName | string | `""` | Database name | |
| 163 | +| server.args.dbPassword | string | `""` | Database password | |
| 164 | +| server.args.dbPort | int | `3306` | Database port | |
| 165 | +| server.args.dbUser | string | `""` | Database user | |
| 166 | +| server.args.defaultSourceRemote | string | `""` | Default source URL | |
| 167 | +| server.args.logFilePath | string | `"/logs/kusion.log"` | Logging | |
| 168 | +| server.args.maxAsyncBuffer | int | `100` | Maximum number of buffer zones during concurrent async executions including generate, preview, apply and destroy | |
| 169 | +| server.args.maxAsyncConcurrent | int | `1` | Maximum number of concurrent async executions including generate, preview, apply and destroy | |
| 170 | +| server.args.maxConcurrent | int | `10` | Maximum number of concurrent executions including preview, apply and destroy | |
| 171 | +| server.args.migrateFile | string | `""` | Migration file path | |
| 172 | +| server.env | list | `[]` | Additional environment variables for the server | |
| 173 | +| server.image.imagePullPolicy | string | `"IfNotPresent"` | Image pull policy | |
| 174 | +| server.image.repo | string | `"kusionstack/kusion"` | Repository for Kusion server image | |
| 175 | +| server.image.tag | string | `""` | Tag for Kusion server image. Defaults to the chart's appVersion if not specified | |
| 176 | +| server.name | string | `"kusion-server"` | Component name for kusion server | |
| 177 | +| server.port | int | `80` | Port for kusion server | |
| 178 | +| server.replicas | int | `1` | The number of kusion server pods to run | |
| 179 | +| server.resources | object | `{"limits":{"cpu":"500m","memory":"1Gi"},"requests":{"cpu":"250m","memory":"256Mi"}}` | Resource limits and requests for the kusion server pods | |
| 180 | +| server.serviceType | string | `"ClusterIP"` | Service type for the kusion server. The available type values list as ["ClusterIP"、"NodePort"、"LoadBalancer"]. | |
| 181 | + |
| 182 | +### MySQL Database |
| 183 | + |
| 184 | +The MySQL database is used to store Kusion's persistent data. |
| 185 | + |
| 186 | +| Key | Type | Default | Description | |
| 187 | +|-----|------|---------|-------------| |
| 188 | +| mysql.database | string | `"kusion"` | MySQL database name | |
| 189 | +| mysql.enabled | bool | `true` | Whether to enable MySQL deployment | |
| 190 | +| mysql.image.imagePullPolicy | string | `"IfNotPresent"` | Image pull policy | |
| 191 | +| mysql.image.repo | string | `"mysql"` | Repository for MySQL image | |
| 192 | +| mysql.image.tag | string | `"8.0"` | Specific tag for MySQL image | |
| 193 | +| mysql.name | string | `"mysql"` | Component name for MySQL | |
| 194 | +| mysql.password | string | `""` | MySQL password | |
| 195 | +| mysql.persistence.accessModes | list | `["ReadWriteOnce"]` | Access modes for MySQL PVC | |
| 196 | +| mysql.persistence.size | string | `"10Gi"` | Size of MySQL persistent volume | |
| 197 | +| mysql.persistence.storageClass | string | `""` | Storage class for MySQL PVC | |
| 198 | +| mysql.port | int | `3306` | Port for MySQL | |
| 199 | +| mysql.replicas | int | `1` | The number of MySQL pods to run | |
| 200 | +| mysql.resources | object | `{"limits":{"cpu":"1000m","memory":"1Gi"},"requests":{"cpu":"250m","memory":"512Mi"}}` | Resource limits and requests for MySQL pods | |
| 201 | +| mysql.rootPassword | string | `""` | MySQL root password | |
| 202 | +| mysql.user | string | `"kusion"` | MySQL user | |
| 203 | + |
| 204 | +### KubeConfig |
| 205 | + |
| 206 | +The KubeConfig is used to store the KubeConfig files for the Kusion Server. |
| 207 | + |
| 208 | +| Key | Type | Default | Description | |
| 209 | +|-----|------|---------|-------------| |
| 210 | +| kubeconfig.kubeConfigVolumeMountPath | string | `"/var/run/secrets/kubernetes.io/kubeconfigs/"` | Volume mount path for KubeConfig files | |
| 211 | +| kubeconfig.kubeConfigs | object | `{}` | KubeConfig contents map | |
| 212 | + |
| 213 | +**NOTE**: The KubeConfig contents map is a key-value pair, where the key is the key of the KubeConfig file and the value is the contents of the KubeConfig file. |
| 214 | + |
| 215 | +```yaml |
| 216 | +# Example structure: |
| 217 | + kubeConfigs: |
| 218 | + kubeconfig0: | |
| 219 | + Please fill in your KubeConfig contents here. |
| 220 | + kubeconfig1: | |
| 221 | + Please fill in your KubeConfig contents here. |
| 222 | +``` |
0 commit comments