Running pre- and post- install scripts.

Running pre- and post- install scripts.

Overview

Sometimes it is required to run additional commands during cluster provisioning. Kublr gives user a way to run pre- and post- install scripts that will be executedd before and after kublr-agent installation on each host of the cluster.

How to use it.

ClusterSpec allows user to provide list of commands to be executed during kubernetes cluster provisioning.

Kublr allows you to specify the commands that will be executed before and after kubernates installation.

To do this, you need to add the appropriate fields to the cluster specification:

  1. Before starting the cluster creation, open the cluster specification by clicking the ‘Cluster creation specification’.
  2. Add the following block to the required instance group:

    kublrAgentConfig:
    kublr:
        setup:
        cmd:
            before: ["/bin/sh", "-c", "command 1; ...; commandn"]
            after: ["/bin/sh", "-c", "command 1; ...; commandn"]
  3. Start cluster creation

Example

The following cluster specification will disable ‘noexec’ flag on /tmp before installation and enable it after successful installation:

kind: Cluster
metadata:
  ownerReferences: []
  name: MyCluster
  space: MySpace
spec:
  master:
    locations:
      -
        baremetal:
          hosts:
            -
              address: 192.168.1.1
        locationRef: bare-metal1
    minNodes: 1
    name: master
    kublrAgentConfig:
      kublr:
        setup:
          cmd:
            before: ["/bin/sh", "-c", "mount -oremount,exec /tmp"]
            after: ["/bin/sh", "-c", "mount -oremount,noexec /tmp"]
  locations:
    -
      name: bare-metal1
      baremetal: {}
  nodes:
    -
      locations:
        -
          baremetal: {}
          locationRef: bare-metal1
      minNodes: 2
      name: default
      kublrAgentConfig:
        kublr:
          setup:
            cmd:
              before: ["/bin/sh", "-c", "mount -oremount,exec /tmp"]
              after: ["/bin/sh", "-c", "mount -oremount,noexec /tmp"]

Questions? Suggestions? Need help? Contact us.