Bundle Walk-Through

Overview
This is a walk-through for demonstrating Pacemaker's "bundle" feature.

Prerequisites
Choose what OS (including version) you wish to use on the cluster nodes and inside the containers. The cluster nodes must have Pacemaker 1.1.17 or later; the containers must have Pacemaker 1.1.12 or later (for Pacemaker Remote support). This walk-through will use CentOS 7.3 for both (with Pacemaker 1.1.17 packages installed from RPM, for the cluster nodes); the differences for other OSes should be minor.

Configure a test cluster of at least two cluster nodes, with no Pacemaker Remote nodes.

Each cluster node should have at least 450MB free disk space.

Preparation
Repeat on every node:


 * Install docker. If your distribution doesn't provide docker packages, you can get them from the upstream Docker repository:


 * 1) yum install docker


 * Enable docker to run at boot:


 * 1) systemctl enable --now docker


 * Pull a Docker base image for the container OS:


 * 1) docker pull centos:centos7


 * Create some infrastructure for the walk-through:

/var/log/pacemaker/bundles/httpd-bundle-{0,1,2} \ /var/local/containers/httpd-bundle-{0,1,2} Bundle test httpd-bundle-$i @ $(hostname) EOF done
 * 1) mkdir -p /root/bundle-walk-through \
 * 1) for i in 0 1 2; do cat >/var/local/containers/httpd-bundle-$i/index.html </root/bundle-walk-through/Dockerfile <<EOF

RUN yum update -y RUN yum install -y httpd bind-utils curl lsof wget which RUN yum install -y pacemaker pacemaker-remote resource-agents EOF

Build a container image
This needs to be done on every node. Once is sufficient, but you should repeat this step if you make changes to the Dockerfile.


 * Build the image:


 * 1) cd /root/bundle-walk-through
 * 2) docker rmi pcmktest:http
 * 3) docker build -t pcmktest:http.


 * If desired, verify that the image was created:


 * 1) docker images

The output should look something like: REPOSITORY         TAG                 IMAGE ID            CREATED              SIZE pcmktest           http                aab04ad64ab0        About a minute ago   412 MB centos              centos7             98d35105a391        12 days ago          192 MB


 * You may encounter a docker "waiting for lo to become free" bug. Reboot the node to avoid this possibility.

Configure the cluster

 * From any one node, start the cluster, and configure a bundle using the test image. Replace the IP address with something appropriate (three sequential IPs need to be available):

      '
 * 1) pcs cluster start --all --wait
 * 2) cibadmin --modify --allow-create --scope resources -X '


 * Test away. Three containers should come up, and apache should be reachable at the specified IPs. This feature is experimental, and not all things you'd expect to do with a regular resource are implemented for bundles yet. You can also modify the bundle configuration to try different values. The docker instances will be named like httpd-bundle-docker-0, so you can use standard docker commands with that (e.g. docker inspect or docker exec).