Skip to main content

ConfigValues

This topic describes the Replicated KOTS ConfigValues resource. ConfigValues is used to set application configuration values during automated or headless installations from the command line.

For information about the Replicated KOTS Config custom resource, which is used to customize the application-specific configuration fields on the Admin Console config screen, see Config.

Overview

The ConfigValues resource lists the values and defaults for each application configuration item defined in the Replicated KOTS Config resource in the release.

In automated or headless installations, end users provide a ConfigValues resource with the install command to set the application configuration values from the command line rather than through the Admin Console UI. For more information about performing headless installations with Replicated Embedded Cluster, see Automate Embedded Cluster Installations. For information about performing headless installations with KOTS in an existing cluster, see Install with the KOTS CLI.

Additionally, for each installation, the Admin Console automatically generates a ConfigValues resource and makes it available for download in the Admin Console View files tab or with the kots get config command. For more information, see Download the ConfigValues for an Installation below.

The following image shows how application configuration items defined a Config resource map to a ConfigValues resource:

Config fields mapped from Config resource to ConfigValues resource

View a larger version of this image

As shown in the image above, the values key in the ConfigValues resource lists each item from the Config resource by its name. For each item, the ConfigValues resource lists the user-supplied value as well as the default that was defined in the Config resource (if applicable).

Example

apiVersion: kots.io/v1beta1
kind: ConfigValues
spec:
values:
config_item_name:
default: example_default_value
value: example_value
boolean_config_item_name:
value: "1"
password_config_item_name:
valuePlainText: exampleplaintextpassword
select_one_config_item_name:
default: default_option_name
value: selected_option_name

Requirements

The ConfigValues resource must meet the following requirements:

  • Must be valid YAML.
  • It is not necessary to set a value for each configuration item in the ConfigValues, unless the item is required and has no default set in the Config resource.
  • For any configuration items of type password defined in the Config resource, set the value in plain text in the ConfigValues valuePlainText property rather than in the value property. For example, valuePlainText: somesecretvalue. Values set in valuePlainText are automatically encrypted during installation.
  • All values must be strings. For booleans, integers, or floats, wrap the value in quotes (for example, value: "1", value: "0", or value: "443").

Limitation

Replicated template functions are not supported in the ConfigValues resource. To set an application configuration item to a value rendered by a template function, you can use a template function in the default or value property for the item in the Config resource.

For more information about working with Replicated template functions, see About Template Functions.

Spec

values.[item_name].default

The item's default value, as defined in the Config custom resource in the release.

Example

apiVersion: kots.io/v1beta1
kind: ConfigValues
spec:
values:
certificate_source:
default: generate_internal
deploy_postgres:
default: "1"
value: "0"
service_type:
default: cluster_ip
value: node_port
node_port_port:
default: "443"
value: "3000"

values.[item_name].value

The user-supplied value for the application configuration item.

Example

apiVersion: kots.io/v1beta1
kind: ConfigValues
spec:
values:
slack_clientid:
value: T057KR02S
slackernews_domain:
value: hello.ingress.replicatedcluster.com
slackernews_admin_user_emails:
value: mandy@nitflex.com, jeff@nitflex.com, anil@nitflex.com
service_type:
value: node_port
node_port_port:
value: "443"
note

In the ConfigValues resource that is automatically generated by the Admin Console as part of installation, the value property might also be set to one of the following:

  • A value rendered by a Replicated template function. For example, a hidden item defined in the Config resource could use the Replicated RandomString template function to set the value with value: repl{{ RandomString 40}}. In this case, the value for the item in the ConfigValues would be generated by the template function and not user-supplied. For more information about using Replicated template functions, see About Template Functions.
  • An encrypted empty string. For any password configuration items without a user-supplied value, the Admin Console sets the value to an empty string. In the ConfigValues generated for the installation, this empty string is automatically encrypted.
  • An empty mapping ({}). For configuration items without a user-supplied value or a default set, the value is set to {}.

values.[item_name].valuePlainText

A plain text value. For any configuration items of type password, the password must be provided in plain text in a valuePlainText property rather than in the value property.

During installation, the Admin Console encrypts the values set in valuePlainText. In the ConfigValues resource that is automatically generated as part of installation, these encrypted values are saved in value properties. The image below shows how a valuePlainText value is encrypted and added to a value property during installation:

valuesPlainText field in ConfigValues

View a larger version of this image

Example

apiVersion: kots.io/v1beta1
kind: ConfigValues
spec:
values:
slack_bot_token:
valuePlainText: examplebottoken
slack_clientsecret:
valuePlainText: exampleclientsecret
slack_user_token:
valuePlainText: exampleusertoken

Download the ConfigValues for an Installation

For each installation, the Admin Console automatically generates a ConfigValues resource and makes it available for download in the Admin Console View files tab or with the kots get config command.

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 from an installed application instance:

  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 or Online Installation in Existing Clusters with KOTS.

  2. Depending on the installer that you used, do one of the following to get the ConfigValues for the installed instance:

    • 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

      View a larger version of this image

    • 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.