5.6. Customizing Presto Docker Images#

Custom Bootstrap Script#

Adding a bootstrap script to the Presto pods allows you to perform custom actions prior to the Presto startup. The script is executed after Presto configuration setup, but before starting the Presto server.

The custom bootstrap script is added via the additionalBootstrapScriptVolume in the Presto resource. The property needs to be a YAML fragment that defines a volume. Any Kubernetes volume type.

The volume is required to have a bootstrap.sh file, and additional files are allowed and provide further resources. The volume is mounted in all the Presto pods.

The script is passed the string literal coordinator or worker when executed. This allows you to use the same script to program different behavior:

if [ "$1" = "coordinator" ]; then
  echo "Bootstrapping coordinator"

elif [ "$1" = "worker" ]; then
  echo "Bootstrapping worker"


For example, the additionalBootstrapScriptVolume can be specified as a ConfigMap volume:

    name: my-bootstrap-script-volume

You can add the ConfigMap to the Kubernetes resource. The following example contains the bootstrap.sh script inlined in the YAML syntax as multi-line string.

kind: ConfigMap
apiVersion: v1
  name: my-bootstrap-script-volume
  namespace: <my-namespace>
  bootstrap.sh: |-
    echo "Hello World." > /tmp/hello.txt

Note that it is also possible to mount multiple bootstrap script volumes via the additionalBootstrapScriptVolumes property:

  - configMap:
      name: my-bootstrap-script-volume-1
  - configMap:
      name: my-bootstrap-script-volume-2

Bootstrap scripts are applied in the order they are defined in additionalBootstrapScriptVolumes. additionalBootstrapScriptVolume bootstrap script is applied before any of the scripts defined in additionalBootstrapScriptVolumes.

Building Custom Presto Docker Images#

The Custom Bootstrap Script script mechanism, is a lighter, built-in way to customize the default Presto pod, without the need to build a separate custom Presto Docker image, it should suffice for most extension needs.

If you need to do more extensive changes to the underlying node, it is possible to build custom Presto Docker images used by Presto cluster. This allows you to to extend Presto with additional features, which are not supported by default, or otherwise modify the Presto nodes.

In order to build a custom Presto Docker image you must create a Docker image that is based on the SEP Docker image, e.g.

FROM starburstdata/presto:332-e.9-k8s-0.51
LABEL maintainer="..."

# Your custom Docker image steps

Modify the /usr/local/bin/entrypoint.sh script, which is responsible for autoconfiguring and launching Presto, if you need changes to the startup. Your custom steps should be executed after Presto is autoconfigured by presto-autoconfigure program, in addition to, or instead of, the additional bootstrap script handling.

Once you have built your custom Presto Docker image and published it to your container registry, you can use it within the cluster by updating the image section of resource:

apiVersion: starburstdata.com/v1
kind: Presto
  name: presto-cluster-name
    name: custom-org/custom-presto-image:tag
    pullPolicy: IfNotPresent