Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add EC --config-values flag and update automated install docs #2830

Merged
merged 14 commits into from
Nov 19, 2024
105 changes: 70 additions & 35 deletions docs/enterprise/installing-existing-cluster-automation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,53 +15,48 @@ import PlaceholderRoCreds from "../partials/install/_placeholder-ro-creds.mdx"

# Installing with the CLI

This topic describes how to use the Replicated KOTS CLI to install an application.
This topic describes how to install an application with Replicated KOTS, Replicated Embedded Cluster, or Replicated kURL from the command line.

## Overview

You can use the KOTS CLI to install an application rather than using the KOTS Admin Console UI. In a CLI installation, you provide all the necessary artifacts to configure and install the application with the `kots install` command. For example, rather than uploading your license file in the Admin Console, you provide your license file with the `kots install` command using the `--license-file` flag. Additionally, any preflight checks defined for the application automatically run from the CLI rather than being displayed in the Admin Console.
You can use the command line to install an application with Replicated KOTS, Replicated Embedded Cluster, or Replicated kURL. A common use case for installing with the CLI is to automate installation, such as performing headless installations as part of CI/CD pipelines.

The following shows an example of the output from the `kots install` command:
To install with the CLI, you provide all the necessary installation assets, such as the license file and the application config values, with the installation command rather than through the Admin Console UI. Any preflight checks defined for the application run automatically during CLI installations rather than being displayed in the Admin Console.
paigecalvert marked this conversation as resolved.
Show resolved Hide resolved

```bash
• Deploying Admin Console
• Creating namespace ✓
• Waiting for datastore to be ready ✓
• Waiting for Admin Console to be ready ✓
• Waiting for installation to complete ✓
• Waiting for preflight checks to complete ✓

• Press Ctrl+C to exit
• Go to http://localhost:8800 to access the Admin Console

• Go to http://localhost:8888 to access the application
```
## Prerequisite

One common use case for installing with the CLI is to automate installation, such as installing applications as part of CI/CD pipelines. CLI installations are supported for _online_ environments (with outbound internet access), _air gap_ environments (without outbound internet access), existing clusters, and clusters created with Replicated kURL on a VM or bare metal server.
Create a ConfigValues YAML file to define the configuration values for the application release. You will pass the ConfigValues file with the installation command. For air-gapped environments, ensure that the ConfigValues file can be accessed from the installation environment.

For more information about the advanced options for the `kots install` command, see [install](/reference/kots-cli-install) in the KOTS CLI documentation.
For more information, see [Generating a ConfigValues File](/vendor/releases-configvalues).

For a tutorial that demonstrates how to install a sample application using the KOTS CLI, see [Install with KOTS in an Existing Cluster](/vendor/tutorial-cli-setup).
**Example:**

## Limitation
<ConfigValuesExample/>

## Install

[Replicated Embedded Cluster](/vendor/embedded-overview) does not support automated, or _headless_, installations with the KOTS CLI.
### Embedded Cluster
paigecalvert marked this conversation as resolved.
Show resolved Hide resolved

## Prerequisite
To install with Embedded Cluster in an online environment:

Create a ConfigValues YAML file to define the configuration settings for the application. For air gap environments, ensure that you can access the ConfigValues file that you create from your installation environment.
1. Follow the steps provided in the Vendor Portal to download and untar the Embedded Cluster installation assets. For more information, see [Online Installation with Embedded Cluster](/enterprise/installing-embedded).

A ConfigValues file includes the names of the configuration fields for the application along with a user-supplied `value` for each field. The ConfigValues file is specific to the application. For more information, see [Generating a ConfigValues File](/vendor/releases-configvalues).
1. Run the following command to install:

**Example:**
```bash
sudo ./APP_SLUG install --license-file PATH_TO_LICENSE \
--config-values PATH_TO_CONFIGVALUES \
--admin-console-password ADMIN_CONSOLE_PASSWORD
```

<ConfigValuesExample/>

## Install
Replace:
* `APP_SLUG` with the unique slug for the application.
* `LICENSE_FILE` with the customer license.
* `ADMIN_CONSOLE_PASSWORD` with a password for accessing the Admin Console.
* `PATH_TO_CONFIGVALUES` with the path to the ConfigValues file. See [Generating a ConfigValues File](/vendor/releases-configvalues).
paigecalvert marked this conversation as resolved.
Show resolved Hide resolved

This section provides the steps for installing an application with the KOTS CLI in different types of environments.

### Existing Cluster
### KOTS in an Existing Cluster
paigecalvert marked this conversation as resolved.
Show resolved Hide resolved

To install with KOTS in an existing cluster:

Expand All @@ -83,7 +78,23 @@ To install with KOTS in an existing cluster:

<PlaceholderNamespaceExisting/>

### kURL Cluster
The following shows an example of the output from the kots install command:

```bash
• Deploying Admin Console
• Creating namespace ✓
• Waiting for datastore to be ready ✓
• Waiting for Admin Console to be ready ✓
• Waiting for installation to complete ✓
• Waiting for preflight checks to complete ✓

• Press Ctrl+C to exit
• Go to http://localhost:8800 to access the Admin Console

• Go to http://localhost:8888 to access the application
```
paigecalvert marked this conversation as resolved.
Show resolved Hide resolved

### kURL

<IntroEmbedded/>

Expand Down Expand Up @@ -112,9 +123,33 @@ To install with kURL on a VM or bare metal server:

<PlaceholderNamespaceEmbedded/>

### Air Gap Existing Cluster
## Air Gap Install

### Embedded Cluster

To install with Embedded Cluster in an air-gapped environment:

1. Follow the steps provided in the Vendor Portal to download and untar the Embedded Cluster air gap installation assets. For more information, see [Air Gap Installation with Embedded Cluster](/enterprise/installing-embedded-air-gap).

1. Ensure that the Embedded Cluster installation assets are available on the air-gapped machine, then run the following command to install:

```bash
sudo ./APP_SLUG install --license-file PATH_TO_LICENSE \
--config-values PATH_TO_CONFIGVALUES \
--admin-console-password ADMIN_CONSOLE_PASSWORD \
--airgap-bundle PATH_TO_AIRGAP_BUNDLE
```

Replace:
* `APP_SLUG` with the unique slug for the application.
* `LICENSE_FILE` with the customer license.
* `PATH_TO_CONFIGVALUES` with the path to the ConfigValues file. See [Generating a ConfigValues File](/vendor/releases-configvalues).
* `ADMIN_CONSOLE_PASSWORD` with a password for accessing the Admin Console.
* `PATH_TO_AIRGAP_BUNDLE` with the path to the Embedded Cluster `.airgap` bundle for the release.

### KOTS in an Existing Cluster

To install with KOTS in an air gap existing cluster:
To install with KOTS in an air-gapped existing cluster:

1. <InstallKotsCliAirGap/>

Expand Down Expand Up @@ -149,11 +184,11 @@ To install with KOTS in an air gap existing cluster:

<PlaceholderRoCreds/>

### Air Gap kURL Cluster
### kURL

<IntroEmbedded/>

To install in an air gap kURL cluster on a VM or bare metal server:
To install in an air-gapped kURL cluster:

1. Download the kURL `.tar.gz` air gap bundle:

Expand Down
21 changes: 18 additions & 3 deletions docs/reference/embedded-cluster-install.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ sudo ./APP_SLUG install --license LICENSE_FILE [flags]
<p>The range of IP addresses that can be assigned to Pods and Services, in CIDR notation. **Default:** By default, the CIDR block is `10.244.0.0/16`.</p>
</td>
</tr>
<tr>
<td>`--config-values`</td>
<td>
<p>Path to the ConfigValues file for the application. The ConfigValues file can be used to pass the application configuration values from the command line during installation, such as when performing automated installations as part of CI/CD pipelines. For more information about generating the ConfigValues file for a release, see [Generating a ConfigValues File](/vendor/releases-configvalues).</p>
<p><strong>Requirement:</strong> Embedded Cluster 1.18.0 and later.</p>
</td>
</tr>
paigecalvert marked this conversation as resolved.
Show resolved Hide resolved
<tr>
<td>`--data-dir`</td>
<td>
Expand Down Expand Up @@ -113,13 +120,13 @@ sudo ./APP_SLUG install --license LICENSE_FILE [flags]
### Air Gap Install

```bash
sudo ./myapp install --license license.yaml --airgap-bundle myapp.airgap
sudo ./my-app install --license license.yaml --airgap-bundle myapp.airgap
```

### Change the Admin Console and LAM Ports

```bash
sudo ./myapp install --license license.yaml --admin-console-port=20000 --local-artifact-mirror-port=40000
sudo ./my-app install --license license.yaml --admin-console-port=20000 --local-artifact-mirror-port=40000
```

### Change the Data Directory
Expand All @@ -128,6 +135,14 @@ sudo ./myapp install --license license.yaml --admin-console-port=20000 --local-a
sudo ./my-app install --license license.yaml --data-dir /data/embedded-cluster
```

### Headless (Automated) Install
ajp-io marked this conversation as resolved.
Show resolved Hide resolved

```bash
sudo ./my-app install --license license.yaml \
--config-values configvalues.yaml \
--admin-console-password password
```

### Install Behind a Proxy

```bash
Expand All @@ -144,7 +159,7 @@ Where:
### Install Behind an MITM Proxy

```bash
sudo ./APP_SLUG install --license license.yaml --private-ca /path/to/private-ca-bundle \
sudo ./my-app install --license license.yaml --private-ca /path/to/private-ca-bundle \
--http-proxy=http://10.128.0.0:3300 \
--https-proxy=http://10.128.0.0:3300 \
--no-proxy=123.89.46.4,10.96.0.0/16,*.example.com
Expand Down
67 changes: 46 additions & 21 deletions docs/vendor/releases-configvalues.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,66 @@ import TextAreaExample from "../partials/configValues/_textareaExample.mdx"

# Generating a ConfigValues File

This topic describes how to view the ConfigValues file for an application installed with Replicated KOTS and prepare the ConfigValues file to be shared with your users.
This topic describes how to generate the Replicated KOTS ConfigValues file for an application release. It also includes recommendations for how to prepare a sample ConfigValues file to be shared with your users.
paigecalvert marked this conversation as resolved.
Show resolved Hide resolved

## About ConfigValues Files
## Overview

A ConfigValues file defines the user-supplied configuration values for an application installed with KOTS. Enterprise users can provide a ConfigValues file to configure an application during automated installations with the KOTS CLI. During installation, KOTS reads the values in the ConfigValues file to configure the application. For more information about automated installations with the KOTS CLI, see [Installing with the CLI](/enterprise/installing-existing-cluster-automation).

ConfigValues files include the configuration fields defined in the Config custom resource for the release, along with the user-supplied and default values for each field. The following is an example of a ConfigValues file:
The KOTS ConfigValues file includes the fields that are defined in the KOTS Config custom resource for an application release, along with the user-supplied and default values for each field. The following is an example of a ConfigValues file:

<ConfigValuesExample/>

The ConfigValues file allows you to pass the configuration values for an application from the command line with the install command, rather than through the Admin Console UI. This supports automated or _headless_ installations, such as when installing an application as part of CI/CD pipelines.

For more information about installing from the command line, see [Installing with the CLI](/enterprise/installing-existing-cluster-automation).

## Get the ConfigValues File

When installing an application, KOTS automatically generates a ConfigValues file and saves the file in a directory called `upstream`. After installation, you can view the generated ConfigValues file.
During installation, KOTS automatically generates a ConfigValues file and saves the file in a directory called `upstream`. After installation, you can view the generated ConfigValues file in the Admin Console **View files** tab or from the command line by running the `kubectl kots get config` command.

To get the ConfigValues file for an application:
To get the ConfigValues file for a release:
paigecalvert marked this conversation as resolved.
Show resolved Hide resolved

1. Install the target release for the application in a development environment. For more information, see [About Installing an Application](/enterprise/installing-overview).
1. Install the target release in a development environment. You can either install the release with Replicated Embedded Cluster or install in an existing cluster with KOTS. For more information, see [Online Installation with Embedded Cluster](/enterprise/installing-embedded) or [Online Installation in Existing Clusters](/enterprise/installing-existing-cluster).

1. View the generated ConfigValues file for the installed instance:
1. Depending on the installer that you used, do one of the following to get the ConfigValues for the installed instance:
paigecalvert marked this conversation as resolved.
Show resolved Hide resolved

```
kubectl kots get config --namespace APP_NAMESPACE --decrypt
```
Where `APP_NAMESPACE` is the cluster namespace where the application is installed.

:::note
The `--decrypt` flag decrypts all configuration fields with `type: password`. In the downloaded ConfigValues file, the decrypted value is stored in a `valuePlaintext` field.
:::
* **For Embedded Cluster installations**: In the Admin Console, go to the **View files** tab. In the filetree, go to **upstream > userdata** and open **config.yaml**, as shown in the image below:

![ConfigValues file in the Admin Console View Files tab](/images/admin-console-view-files-configvalues.png)

[View a larger version of this image](/images/admin-console-view-files-configvalues.png)

The output of the `kots get config` command is the contents of the ConfigValues file. For more information about the `kots get config` command, including additional flags, see [kots get config](/reference/kots-cli-get-config).
* **For KOTS installations in an existing cluster**: Run the `kubectl kots get config` command to view the generated ConfigValues file:

```
kubectl kots get config --namespace APP_NAMESPACE --decrypt
```
Where:
* `APP_NAMESPACE` is the cluster namespace where KOTS is running.
* The `--decrypt` flag decrypts all configuration fields with `type: password`. In the downloaded ConfigValues file, the decrypted value is stored in a `valuePlaintext` field.

The output of the `kots get config` command shows the contents of the ConfigValues file. For more information about the `kots get config` command, including additional flags, see [kots get config](/reference/kots-cli-get-config).

**Example**:

```bash
kubectl kots get config --namespace namespace --decrypt
```
```bash
apiVersion: kots.io/v1beta1
kind: ConfigValues
metadata:
creationTimestamp: null
spec:
values:
example_item:
value: hello world
```

## Share a Sample ConfigValues File

Replicated recommends that you share an example of an accurate ConfigValues file with your users that they can edit for use in automated installations with the KOTS CLI.
If your users will perform automated or headless installations from the command line, you can share an example of an accurate ConfigValues file that they can edit.

After you get the ConfigValues file for your application using the `kots get config` command, Replicated recommends that you do the following to edit the contents of the ConfigValues file before sharing it with users:
Before sharing a sample ConfigValues with users, Replicated recommends that you edit the sample file in the following ways:

* Remove any configuration fields that have `readonly` set to `true`. Users cannot edit read only fields. For more information, see [readonly](/reference/custom-resource-config#readonly) in _Config_.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hate this readonly and hidden stuff—it confuses me so much. But looking at the table for randomstring, it seems like readonly true is what makes it persistent. False is ephemeral. So just wondering if this should be "remove the false ones."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This content is old enough that I'll make a separate docs story to investigate/confirm... I'm not even sure if the reason that this bullet point appears here actually has to do with ephemeral/persistent values or if it's more like "don't imply to your users that they can set a value for read-only fields"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


Expand All @@ -65,4 +90,4 @@ After you get the ConfigValues file for your application using the `kots get con
<tr><td><code>textarea</code></td><td><p>Plain text in the <code>value</code> field.</p><TextAreaExample/></td></tr>
</table>

For more information about each configuration field type in the Config custom resource, see [Config](/reference/custom-resource-config).
For more information about each configuration field type in the Config custom resource, see [Config](/reference/custom-resource-config).
2 changes: 1 addition & 1 deletion sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ const sidebars = {
},
{
type: 'category',
label: 'Installing with the KOTS CLI',
label: 'Installing with the CLI',
paigecalvert marked this conversation as resolved.
Show resolved Hide resolved
items: [
'enterprise/installing-existing-cluster-automation',
'vendor/releases-configvalues',
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.