Automated/Headless installations in existing cluster with CLI

Great question from today about automating embedded KOTS app manager installs for headless installations.

Hey everyone. Is it possible to use apply config-values to an embedded installation like it is done here for an existing cluster installation? Installing with Automation | Replicated Docs

Solution

For embedded clusters, the same command from the example can be used. You can add additional flags as needed. The kots CLI will be pre-installed on any kurl.sh cluster that includes the kotsadm addon.

Background

Thanks @Stefan_Reinprecht for asking a great clarifying question here – here’s some additional context:

When you install with curl | bash – you do install the KOTS admin console but the only thing that’s unique to “your app” at that point is the App name and Icon. No other app components are installed until a license is uploaded.

While it may seem strange to do a curl | bash install for K8s + KOTS, and then do a kots install command again later, this is by design. This ensures you (and your users) can re-use the same tools in both embedded and existing cluster without having to learn two sets of commands or flags.

Thanks for this post @dex very useful.
I’ve been deploying apps using automation for a while but been doing the last mile config via the kotsadm web UI, noticed the --configvalues option on your linked docs example, initially not sure what the syntax would be for that file and found I could pull an example for my deployed app using

kubectl kots get config --appslug <app slug> -n <deployed namespace>

example for one of my apps looks like this:

apiVersion: kots.io/v1beta1
kind: ConfigValues
spec:
  values:
    num_replicas:
      default: "2"
      value: "4"
    ingress_type:
      default: nodeport
    configselector_1:
      default: "0"
      value: "1"
    optional_config:
      default: red
      value: green
1 Like

@dex My problem is, that after running the initial installation via curl -sSL https://k8s.kurl.sh/APP_SLUG | sudo bash the application will be installed. I for sure can afterwards remove the installation again and redo it with the kubeclt kots command that you linked to, but that doesn’t feel right. I hoped that I could pass some arguments into the installer like with the flag for ‘airgapped’.

Hi Stefan – that’s a good callout – I’ll clarify here and then update the original post.

When you install with curl | bash – you do install the KOTS admin console but the only thing that’s unique to “your app” at that point is the App name and Icon. No other app components are installed until a license is uploaded.

While it may seem strange to do a curl | bash install for K8s + KOTS, and then do a kots install command again later, this is by design to ensure you can re-use the same tools in both embedded and existing cluster without having to learn two sets of commands or flags.

@dex, I am sorry but it doesn’t work for me.
After installing K8s + KOTS and then running the command

kubectl kots install /app-name\ –namespace default --shared-password /password\ –license-file ~/license.yaml --config-values ~/config.yaml

I get following output:

  • Deploying Admin Console
  • Waiting for Admin Console to be ready ✓

  • Done

The only thing which is happening is that the kotsadm-0 pod gets restarted. But the application is not installed. I tried to reuse the default namespace of K8s.

This is the command that I use, may help, wondering if it’s a self signed certs thing;

"PATH=/usr/local/bin:$PATH ; kubectl kots install $KOTS_APP_SLUG/$KOTS_VENDOR_CHANNEL --kubeconfig /etc/kubernetes/admin.conf --insecure-skip-tls-verify --skip-preflights --config-values ~/configvalues.yaml --license-file ~/license.yaml --name $KOTS_APP_SLUG --namespace default"

(Note extra bits added as called via ssh)

@Stefan_Reinprecht this may just be a copy-paste issue, but from here it looks like you lost the newlines in the command? If you run it without the line breaks, you need to remove the \ in between each argument.

@dex i just formatted it this way, the real command looks like this:

kubectl kots install APPNAME –namespace default --shared-password PASSWORD –license-file ~/license.yaml --config-values ~/config.yaml