Deploying an IBM Spectrum Symphony cluster with Kubernetes and Docker containers
Kubernetes is an open source system for managing containerized applications across multiple hosts, providing basic mechanisms for deployment, maintenance, and scaling of applications. Kubernetes is a good platform to deploy primary-secondary mode applications. You can deploy IBM® Spectrum Symphony with Kubernetes and run its services in Docker containers. This configuration is supported on Red Hat Enterprise Linux (RHEL) 64-bit primary and compute hosts.
Before you begin
Cluster deployment of IBM Spectrum Symphony with Kubernetes is
supported by the following third-party software:
- Docker 1.9.1 or later (see Supported Docker versions for details)
- Kubernetes 1.3.0
- Weave 1.8.2
- etcd 2.3.7
This procedure require that you use the following configuration files, which are provided with
IBM Spectrum Symphony Standard and
Advanced editions:
- Dockerfile, which is used to build the Docker image.
- YAML file for the IBM Spectrum Symphony primary host, which is used to start and control the IBM Spectrum Symphony primary host in the Kubernetes cluster.
- YAML file for IBM Spectrum Symphony compute nodes, which is used to start and control the Symphony compute nodes in the Kubernetes cluster.
Procedure
-
Install Kubernetes, Docker, and etcd on all hosts:
yum install -y kubernetes etcdNote: Docker is installed automatically after Kubernetes is installed. -
Build an IBM Spectrum Symphony
Docker image.
-
Start the Docker daemon:
systemctl start docker -
Use the docker build command to create an IBM Spectrum Symphony Docker image from the
definition contained in the Dockerfile. For example, run:
docker build -t sym720:V1 /root/73.1/where 73.1 is the current working directory that contains the Dockerfile.Note: The sample Dockerfile uses a Red Hat 7 base Docker image. If you want to use another base Docker image, ensure that it can be installed and run the IBM Spectrum Symphony package successfully.The following is an example of the Dockerfile:
FROM rhel # Add user 'egoadmin' & install ssh-server and other basic tools RUN useradd -m egoadmin \ && echo "egoadmin:egoadmin" | chpasswd \ && echo "egoadmin ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers \ && useradd -m hadoop \ && echo "hadoop:hadoop" | chpasswd \ && echo "hadoop ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers \ && echo -e "[base] \nname=CentOS-7 - Base - centos.com\nbaseurl=http://mirror.centos.org/centos/7/os/$basearch/\ngpgcheck=1\ngpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7">/etc/yum.repos.d/CentOS7-Base.repo \ && yum clean all \ && yum makecache fast \ && yum install -y openssh-server which net-tools sudo wget hostname tar openssh-clients \ && yum install -y gettext rsh iputils vim telnet gdb \ && sed -i 's/UsePAM yes/UsePAM no/g' /etc/ssh/sshd_config \ && ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key \ && ssh-keygen -t dsa -f /etc/ssh/ssh_host_ed25519_key \ && ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key \ && mkdir /var/run/sshd #Copy entitlement file to container ADD sym_adv_entitlement.dat /opt/sym_adv_entitlement.dat # Download & Install Symphony package RUN wget --no-check-certificate -O /opt/sym-7.2.0.0_x86_64.bin https://example.ibm.com/engr/pcc/release_eng/work/sym/sym_mainline/last/sym-7.2.0.0_x86_64.bin \ && export CLUSTERADMIN=root \ && export CLUSTERNAME=mycluster \ && export SIMPLIFIEDWEM=N \ && export BASEPORT=10086 \ && chmod +x /opt/* \ && /opt/sym-7.2.0.0_x86_64.bin --prefix /opt/ibm/spectrumcomputing --dbpath /opt/ibm/spectrumcomputing/db --quiet \ && rm -rf /opt/*.bin USER root CMD ["/usr/sbin/sshd", "-D"]Note: The IBM Spectrum Symphony entitlement file will be called while building the Docker image. This means the entitlement file must be in the same directory as the Docker image. The entitlement file from the local host will be added into the Docker image under the /opt/ directory (the operating system directory in the Docker container). -
Optional: Push the Docker image to a private Docker registry so that all Kubernetes minion
nodes can pull the Docker image from the Docker registry automatically:
docker tag sym712:v1 192.168.1.100:5000/sym73.1:v1 docker push 192.168.1.100:5000/sym73.1:v1where192.168.1.100:5000/sym73.1:v1is the image in the Kubernetes YAML file.Note:192.168.1.100:5000is the private Docker registry.
-
Start the Docker daemon:
-
Install the virtual network Weave on all hosts:
sudo curl -L git.io/weave -o /usr/local/bin/weave sudo chmod +x /usr/local/bin/weave systemctl start docker weave setupNote: Weave will include the Docker image from the public Docker hub, so ensure all Docker hosts have Internet access. Weave will start the service in the Docker container, so do not try to stop those containers already started by Weave. -
Start Weave on all hosts. Choose one host as the Weave primary node and the others as the Weave
secondary nodes to join those hosts to one network.
- Primary node
- Run:
weave launch-proxy --rewrite-inspect --without-dns weave launch-router weave expose - Secondary node
- Run:
weave launch-proxy --rewrite-inspect --without-dns weave launch-router weave_primary_host_name weave expose
-
Configure and start the Kubernetes primary server:
-
Configure the etcd server. Edit the /etc/etcd/etcd.conf file, as
follows:
ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379" ETCD_ADVERTISE_CLIENT_URLS="http://kube-primary:2379" -
Configure the Kubernetes server. Edit the /etc/kubernetes/config file, as
follows:
KUBE_MASTER="--master=http://kube-primary:8080" -
Configure the Kubernetes API server. Edit the /etc/kubernetes/apiserver
file, as follows:
KUBE_API_ADDRESS="--insecure-bind-address=0.0.0.0" KUBE_ETCD_SERVERS="--etcd-servers=http://kube-primary:2379" KUBE_SERVICE_ADDRESSES="--service-cluster-ip-range=10.254.0.0/16" KUBE_ADMISSION_CONTROL="--admission-control=NamespaceLifecycle,NamespaceExists,LimitRanger,SecurityContextDeny,ResourceQuota" -
Start the Kubernetes server:
systemctl restart etcd kube-apiserver kube-controller-manager kube-scheduler
-
Configure the etcd server. Edit the /etc/etcd/etcd.conf file, as
follows:
-
Configure and start the Kubernetes minion server:
-
Edit the /etc/kubernetes/config file, as follows:
KUBE_MASTER="--master=http://kube-primary:8080" -
Edit the /etc/kubernetes/kubelet file:
KUBELET_ADDRESS="--address=0.0.0.0" KUBELET_HOSTNAME="--hostname-override=127.0.0.1" KUBELET_API_SERVER="--api-servers=http://kube-primary:8080" KUBELET_ARGS="--docker-endpoint=unix:/var/run/weave/weave.sock" -
Start the Kubernetes minion:
systemctl restart kube-proxy kubelet
-
Edit the /etc/kubernetes/config file, as follows:
-
Create the IBM Spectrum Symphony
primary host with the
Kubernetes YAML file. Kubernetes will create a Docker container from the YAML file and run the
container start command defined within the YAML file:
kubectl create -f sym-primary-rc.yamlThe following is an example of the sym-primary-rc.yaml file:kind: ReplicationController apiVersion: v1 metadata: name: sym-primary-rc spec: replicas: 1 selector: component: sym-primary template: metadata: labels: component: sym-primary spec: containers: - name: sym-primary image: sym720:V1 command: ["/bin/sh", "-c", "source /opt/ibm/spectrumcomputing/profile.platform; egoconfig join 'hostname' -f; egoconfig setentitlement /opt/sym_adv_entitlement.dat; egosh ego start; /usr/sbin/sshd -D"] resources: requests: memory: 4096Mi cpu: 4.0 limits: memory: 8192Mi cpu: 8.0 securityContext: privileged: true-
Check all the minion nodes are started on the primary host.
NAME LABELS STATUS AGE wavm1.example.ibm.com kubernetes.io/hostname=wavm1.example.ibm.com Ready 2m wavm2.example.ibm.com kubernetes.io/hostname=wavm2.example.ibm.com Ready 4s
-
Check all the minion nodes are started on the primary host.
-
Create the IBM Spectrum Symphony
compute nodes with the YAML file:
-
After the primary host is
created and running, obtain the primary host name and IP address.
Here are examples, with output:
kubectl get pods NAME READY STATUS RESTARTS AGE sym-primary-rc-04yws 1/1 Running 0 46mkubectl describe pod sym-primary-rc-04yws|grep IP IP: 10.32.0.1The following is an example of the sym-compute-rc.yaml file:
kind: ReplicationController apiVersion: v1 metadata: name: sym-compute-rc spec: replicas: 3 selector: component: sym-compute template: metadata: labels: component: sym-compute spec: containers: - name: sym-compute image: sym712:v1 commmand: ["/bin/sh", "-c", "source /opt/ibm/spectrumcomputing/profile.platform; sudo chmod 777 /etc/hosts; echo '10.32.0.1 sym-primary-04yws' >> /etc/hosts; egoconfig join sym-primary-04yws -f; egosh ego start; sudo /usr/sbin/sshd -D"] resources: requests: memory: 2048M -
Manually add the IBM Spectrum Symphony
primary host name and IP
address to the command in the compute node YAML file. For example:
"command: ["/bin/sh", "-c", "source /opt/ibm/spectrumcomputing/profile.platform; sudo chmod 777 /etc/hosts; echo '10.32.0.1 sym-primary-rc-04yws' >> /etc/hosts; egoconfig join sym-primary-rc-04yws -f; egosh ego start; sudo /usr/sbin/sshd -D"]" -
Create the IBM Spectrum Symphony
compute nodes with the YAML file:
Here is an example, with output:
kubectl create -f sym-compute-rc.yaml replicationcontroller "sym-compute-rc" created
-
After the primary host is
created and running, obtain the primary host name and IP address.
-
Scale the compute node size after you have created the compute replication controller if
necessary:
Here is an example, with output:
kubectl scale --replicas=10 replicationcontrollers sym-compute-rc replicationcontroller "sym-compute-rc" scaled -
Create the Kubernetes service to expose the IBM Spectrum Symphonycluster management console:
The following is an example of the Kubernetes service definition file:
kind: Service apiVersion: v1 metadata: name: sym-webgui spec: ports: - port: 8443 targetPort: 8443 protocol: TCP name: https selector: component: sym-primary type: NodePortTo create this file, run the kubectl create command.
Here is an example, with output:kubectl create -f sym-webgui-svc.yaml service "sym-webgui" created