Installing from the Command Line
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 command line to install an application with Replicated KOTS, Replicated Embedded Cluster, or Replicated kURL. A common use case for installing from the command line is to automate installation, such as performing headless installations as part of CI/CD pipelines.
To install from the command line, 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 headless installations from the command line rather than being displayed in the Admin Console.
Prerequisite
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, see Generating a ConfigValues File.
Example:
apiVersion: kots.io/v1beta1
kind: ConfigValues
spec:
values:
text_config_field_name:
default: Example default value
value: Example user-provided value
boolean_config_field_name:
value: "1"
password_config_field_name:
valuePlaintext: examplePassword
Install
Embedded Cluster
To install with Embedded Cluster in an online environment:
-
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.
-
Run the following command to install:
sudo ./APP_SLUG install --license-file PATH_TO_LICENSE \
--config-values PATH_TO_CONFIGVALUES \
--admin-console-password ADMIN_CONSOLE_PASSWORDReplace:
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.
KOTS in an Existing Cluster
To install with KOTS in an existing cluster:
-
Install the KOTS CLI:
curl https://kots.io/install | bash
For more installation options, see Installing the KOTS CLI.
-
Install the application:
kubectl kots install APP_NAME \
--shared-password PASSWORD \
--license-file PATH_TO_LICENSE \
--config-values PATH_TO_CONFIGVALUES \
--namespace NAMESPACE \
--no-port-forwardReplace:
-
APP_NAME
with a name for the application. This is the unique name that KOTS will use to refer to the application that you install. -
PASSWORD
with a shared password for accessing the Admin Console. -
PATH_TO_LICENSE
with the path to your license file. See Downloading Customer Licenses. For information about how to download licenses with the Vendor API v3, see Download a customer license file as YAML in the Vendor API v3 documentation. -
PATH_TO_CONFIGVALUES
with the path to the ConfigValues file. See Generating a ConfigValues File.
NAMESPACE
with the namespace where you want to install both the application and KOTS.
The following shows an example of the output from the kots install command:
• 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 -
kURL
When you use the KOTS CLI to install an application in a kURL cluster, you first run the kURL installation script to provision the cluster and automatically install KOTS in the cluster. Then, you can run the kots install
command to install the application.
To install with kURL on a VM or bare metal server:
-
Create the kURL cluster:
curl -sSL https://k8s.kurl.sh/APP_NAME | sudo bash
-
Install the application in the cluster:
kubectl kots install APP_NAME \
--shared-password PASSWORD \
--license-file PATH_TO_LICENSE \
--config-values PATH_TO_CONFIGVALUES \
--namespace default \
--no-port-forwardReplace:
-
APP_NAME
with a name for the application. This is the unique name that KOTS will use to refer to the application that you install. -
PASSWORD
with a shared password for accessing the Admin Console. -
PATH_TO_LICENSE
with the path to your license file. See Downloading Customer Licenses. For information about how to download licenses with the Vendor API v3, see Download a customer license file as YAML in the Vendor API v3 documentation. -
PATH_TO_CONFIGVALUES
with the path to the ConfigValues file. See Generating a ConfigValues File.
NAMESPACE
with the namespace where Replicated kURL installed Replicated KOTS when creating the cluster. By default, kURL installs KOTS in thedefault
namespace.
-
Air Gap Install
Embedded Cluster
To install with Embedded Cluster in an air-gapped environment:
-
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.
-
Ensure that the Embedded Cluster installation assets are available on the air-gapped machine, then run the following command to install:
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_BUNDLEReplace:
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.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-gapped existing cluster:
-
Install the KOTS CLI. See Manually Download and Install in Installing the KOTS CLI.
-
Download the
kotsadm.tar.gz
air gap bundle from the Releases page in the kots repository in GitHub. Ensure that you can access the downloaded bundle from the environment where you will install the application.noteThe version of the
kotsadm.tar.gz
air gap bundle used must be compatible with the version of the.airgap
bundle for the given application release.noteThe versions of the KOTS CLI and the
kotsadm.tar.gz
bundle must match. You can check the version of the KOTS CLI withkubectl kots version
. -
Extract the KOTS Admin Console container images from the
kotsadm.tar.gz
bundle and push the images to your private registry:kubectl kots admin-console push-images ./kotsadm.tar.gz REGISTRY_HOST \
--registry-username RW_USERNAME \
--registry-password RW_PASSWORDReplace:
-
REGISTRY_HOST
with the hostname for the private registry. For example,private.registry.host
ormy-registry.example.com/my-namespace
. -
RW_USERNAME
andRW_PASSWORD
with the username and password for an account that has read and write access to the private registry.noteKOTS does not store or reuse these read-write credentials.
-
-
Install the application:
kubectl kots install APP_NAME \
--shared-password PASSWORD \
--license-file PATH_TO_LICENSE \
--config-values PATH_TO_CONFIGVALUES \
--airgap-bundle PATH_TO_AIRGAP_BUNDLE \
--namespace NAMESPACE \
--kotsadm-registry REGISTRY_HOST \
--registry-username RO_USERNAME \
--registry-password RO_PASSWORD \
--no-port-forwardReplace:
-
APP_NAME
with a name for the application. This is the unique name that KOTS will use to refer to the application that you install. -
PASSWORD
with a shared password for accessing the Admin Console. -
PATH_TO_LICENSE
with the path to your license file. See Downloading Customer Licenses. For information about how to download licenses with the Vendor API v3, see Download a customer license file as YAML in the Vendor API v3 documentation. -
PATH_TO_CONFIGVALUES
with the path to the ConfigValues file. See Generating a ConfigValues File.
-
PATH_TO_AIRGAP_BUNDLE
with the path to the.airgap
bundle for the application release. You can build and download the air gap bundle for a release in the Vendor Portal on the Release history page for the channel where the release is promoted.Alternatively, for information about building and downloading air gap bundles with the Vendor API v3, see Trigger airgap build for a channel's release and Get airgap bundle download URL for the active release on the channel in the Vendor API v3 documentation.
NAMESPACE
with the namespace where you want to install both the application and KOTS.
-
REGISTRY_HOST
with the same hostname for the private registry where you pushed the Admin Console images. -
RO_USERNAME
andRO_PASSWORD
with the username and password for an account that has read-only access to the private registry.noteKOTS stores these read-only credentials in a Kubernetes secret in the same namespace where the Admin Console is installed.
KOTS uses these credentials to pull the images. To allow KOTS to pull images, the credentials are automatically created as an imagePullSecret on all of the Admin Console Pods.
-
kURL
When you use the KOTS CLI to install an application in a kURL cluster, you first run the kURL installation script to provision the cluster and automatically install KOTS in the cluster. Then, you can run the kots install
command to install the application.
To install in an air-gapped kURL cluster:
-
Download the kURL
.tar.gz
air gap bundle:export REPLICATED_APP=APP_SLUG
curl -LS https://k8s.kurl.sh/bundle/$REPLICATED_APP.tar.gz -o $REPLICATED_APP.tar.gzWhere
APP_SLUG
is the unqiue slug for the application. -
In your installation environment, extract the contents of the kURL
.tar.gz
bundle that you downloaded:tar -xvzf $REPLICATED_APP.tar.gz
-
Create the kURL cluster:
cat install.sh | sudo bash -s airgap
-
Install the application:
kubectl kots install APP_NAME \
--shared-password PASSWORD \
--license-file PATH_TO_LICENSE \
--config-values PATH_TO_CONFIGVALUES \
--airgap-bundle PATH_TO_AIRGAP_BUNDLE \
--namespace default \
--no-port-forwardReplace:
-
APP_NAME
with a name for the application. This is the unique name that KOTS will use to refer to the application that you install. -
PASSWORD
with a shared password for accessing the Admin Console. -
PATH_TO_LICENSE
with the path to your license file. See Downloading Customer Licenses. For information about how to download licenses with the Vendor API v3, see Download a customer license file as YAML in the Vendor API v3 documentation. -
PATH_TO_CONFIGVALUES
with the path to the ConfigValues file. See Generating a ConfigValues File.
-
PATH_TO_AIRGAP_BUNDLE
with the path to the.airgap
bundle for the application release. You can build and download the air gap bundle for a release in the Vendor Portal on the Release history page for the channel where the release is promoted.Alternatively, for information about building and downloading air gap bundles with the Vendor API v3, see Trigger airgap build for a channel's release and Get airgap bundle download URL for the active release on the channel in the Vendor API v3 documentation.
NAMESPACE
with the namespace where Replicated kURL installed Replicated KOTS when creating the cluster. By default, kURL installs KOTS in thedefault
namespace.
-
(Optional) Access the Admin Console
When you install an application in an existing cluster or when you provision a cluster with the kURL installer, you also install KOTS in the cluster. KOTS deploys the Admin Console. The Admin Console is a user interface where you can manage and upgrade your application instances.
By default, during installation, KOTS automatically opens localhost port 8800 to provide access to the Admin Console. The --no-port-forward
flag in the kots install
command prevents KOTS from creating a port forward to the Admin Console.
After you install with the --no-port-forward
flag, you can optionally create a port forward so that you can log in to the Admin Console in a browser window.
To access the Admin Console:
-
If you installed in a VM where you cannot open a browser window, forward a port on your local machine to
localhost:8800
on the remote VM using the SSH client:ssh -L LOCAL_PORT:localhost:8800 USERNAME@IP_ADDRESS
Replace:
LOCAL_PORT
with the port on your local machine to forward. For example,9900
or8800
.USERNAME
with your username for the VM.IP_ADDRESS
with the IP address for the VM.
Example:
The following example shows using the SSH client to forward port 8800 on your local machine to
localhost:8800
on the remote VM.ssh -L 8800:localhost:8800 user@ip-addr
-
Run the following KOTS CLI command to open localhost port 8800, which forwards to the Admin Console service:
kubectl kots admin-console --namespace NAMESPACE
Replace
NAMESPACE
with the namespace where the Admin Console was installed.For more information about the
kots admin-console
command, see admin-console in the KOTS CLI documentation. -
Open a browser window and go to
https://localhost:8800
. -
Log in to the Admin Console using the password that you created as part of the
kots install
command.