Getting a raw kURL installer CR from a URL / ID / Slug

Sometimes it can be helpful to review the existing kURL installer for an application channel as raw YAML. As you may know, a kURL installer implies the existence of three different URLs, e.g. for the installer latest, there will exist

You can use this same pattern with SHA-based installers generated from kurl.sh, or with an application slug from vendor.replicated.com – e.g.

1 Like

To view the kurl spec as a yaml document, you can run this:

curl -sSL https://kurl.sh/latest | sed -e/INSTALLER_YAML/\{ -e:1 -en\;b1 -e\} -ed | sed -n '/ADDONS_HAVE_HOST_COMPONENTS/q;p'

to extract the installer yaml from the install script itself.

Retrieve existing kURL-based k8s distro’s installer spec

  • You can compare .metadata.creationTimestamp of all installers present (kURL cluster installation/upgrade timelines)
kubectl get -n default installers -o json | jq -r ' .items[].metadata.creationTimestamp'
  • In case you’d like a single version for automation:
# either of
kubectl get -n default installers -o json | jq ' .items |= sort_by(.metadata.creationTimestamp)' | yq e '.items[-1]' - | yq e -P -
# or, less reliable
kubectl get -n default installers -o yaml | yq eval '.items[0]' - > ~/installer.yaml

Note :point_up::

  • For one liners, you’ll need yq and/or jq utilities for parsing the yaml output to generate installer.yaml*
  • Either of those commands might not be a super reliable method of getting the latest.
  • Use your best judgement.

Modify retrieved installer spec / generate new kurl.sh URL

You can then modify the versions in installer.yaml as needed, and then generate a new kURL installer URL via:

curl -X POST -H "Content-Type: text/yaml" --data-binary "@installer.yaml" https://kurl.sh/installer && echo ""

This will generate a URL like https://kurl.sh/68e5fb9 …

Provision the cluster

…with which you can then provision a k8s cluster with like this: curl https://kurl.sh/installer_id | sudo bash

Verify results

You can then check the results by listing the current installer’s output again via:

# kubectl get installers -oyaml -ojsonpath="{.items[].spec}" | jq
or
# kubectl get -n default installers -o yaml | yq eval '.items[0]'
or
# kubectl get -n default installers -o json | jq ' .items |= sort_by(.metadata.creationTimestamp)' | yq e '.items[-1]' - | yq e -P -

…which will list the latest version of kURL cluster along with all add-ons installed.