Automate license application with "Kubernetes installer" method

I would like to apply a license to an existing KOTS application installation. We are installing replicated with the “Kubernetes installer” method, and need to apply the license with automation after the admin console is installed. If there are no kots commands that do this, or the curl command can’t take a license flag, is there a file on the host we can modify, like native?

I have read through the example in the automating existing cluster install documentation, but doesn’t seem to apply to our use case.

You can also leave kotsadm out of the kurl installer spec, and install it afterwards.
Or rerun the kots install command after kurl installation is finished.

Can you describe the steps you are currently executing and where it doesn’t work?

Here’s an example:

We run on startup,
curl -sSL | sudo bash

After I tried a few different ways. The license.yaml is downloaded from one of my ‘customers’, renamed in that location.

Each variation (different flags, syntax for app, etc) gets me the same errors posted below.

This way seems the most correct(?), so this is it:

As the root user:

root@ip:/# kubectl kots install llama-k8s/sj-1 --namespace default --license-file ~/license.yaml --no-port-forward
  • Deploying Admin Console
  • Waiting for Admin Console to be ready ✓  
Error: failed to forward port: failed to query healthz: Get "http://localhost:8800/healthz": context deadline exceeded (Client.Timeout exceeded while awaiting headers)

Or as the ubuntu user:

ubuntu@ip:~$ kubectl kots install llama-k8s/sj-1 --namespace default --license-file ~/license.yaml --no-port-forward

Error: failed to check RBAC: failed to get cluster config: failed to convert kube flags to rest config: error loading config file "/etc/kubernetes/admin.conf": open /etc/kubernetes/admin.conf: permission denied

ubuntu@ip:~$ sudo kubectl kots install llama-k8s/sj-1 --namespace default --license-file ~/license.yaml --no-port-forward

Error: failed to check RBAC: failed to run subject review: Post "http://localhost:8080/apis/": dial tcp connect: connection refused

I then checked the logs for the kotsadmin pod… and got

{"level":"error","ts":"2022-10-25T19:05:12Z","msg":"failed to install license kotsadm-default-license: license already exists for app jama-k8s"}


Now I’m in the admin console passed the license page. I think… I might have done something to get myself in a bad state, but now the license is successfully installed. :smiley:

Though not totally sure why I got the errors, ‘failed to query healthz’ which made me keep thrashing.

It can be that you have to specify the --wait-duration flag from the install command. If it still occurs, can you provide a support bundle?