Before you begin
Ensure the following:
- You are logged in to a control plane node of your cluster.
- The Alpine Linux image is available.
- You are using the default namespace.
See the troubleshooting section if you experience problems.
Creating local storage volumes
- Create storage classes.
The script creates the following storage classes: [release]-local-storage-cassandra [release]-local-storage-cassandra-bak [release]-local-storage-kafka [release]-local-storage-zookeeper [release]-local-storage-couchdb [release]-local-storage-db2 [release]-local-storage-impactgui [release]-local-storage-ncobackup [release]-local-storage-ncoprimary [release]-local-storage-openldap [release]-local-storage-scala [release]-local-storage-nciserver
- Create PVs.
The script creates the following PVs for each node: [release]-local-storage-cassandra-[node] [release]-local-storage-cassandra-bak-[node] [release]-local-storage-kafka-[node] [release]-local-storage-zookeeper-[node] [release]-local-storage-couchdb-[node] [release]-local-storage-db2-[node] [release]-local-storage-impactgui-[node] [release]-local-storage-ncobackup-[node] [release]-local-storage-ncoprimary-[node] [release]-local-storage-openldap-[node] [release]-local-storage-scala-[node] [release]-local-storage-nciserver-[node]
- Create directories.
On each worker node, the script creates directories under the root directory: [root]/[release]/cassandra [root]/[release]/cassandra-bak [root]/[release]/kafka [root]/[release]/zookeeper [root]/[release]/couchdb [root]/[release]/db2 [root]/[release]/impactgui [root]/[release]/ncoprimary [root]/[release]/ncobackup [root]/[release]/openldap [root]/[release]/scala [root]/[release]/nciserver
The script can either automatically create required storage classes, PVs, and directories. Or, the script can output a YAML template, which can be used with the kubectl create -f command.
Deleting local volumes
In addition to creating local storage artifacts, the script also outputs a delete script called deleteStorageAllNodes.sh, which removes all artifacts created by the createStorageAllNodes.sh script.Create script usage
%> ./createStorageAllNodes.sh -h This script will create local Storage Classes, Persistent Volumes and Directories required by Netcool Operations Insight Usage: ./createStorageAllNodes.sh [-dnryh] [-d base directory path] [-n nodes] [-r release name] [-y yaml output only] [-s silent mode] [-h help]
Examples
Create storage on all worker nodes
The following example creates storage for a Netcool Operations Insight release callednoi with a root directory path on each worker node of the /home/netcool/ibm-netcool/prod path. A deleteStorageAllNodes.sh delete script is also created. %> ./createStorageAllNodes.sh -d /home/netcool/ibm-netcool-prod
Create storage on a specified node
The following example creates storage for a Netcool Operations Insight release callednoi with a root directory path on each worker node of the /home/netcool/ibm-netcool/prod path. A deleteStorageAllNodes.sh delete script is also created. %> ./createStorageAllNodes.sh -n "10.2.3.4 10.2.3.5"
Create YAML template
The following example outputs a YAML template filenoi-storage.yaml, which can be used with the kubectl create -f command to create storage for a Netcool Operations Insight release called noi with a root directory of /root/ibm-netcool-prod. No delete script is created. Instead, the storage artifacts can be removed by running the kubectl delete -f noi-storage.yaml command. Note: This example does not remove the storage directories on the nodes. They must be removed manually.
%> ./createStorageAllNodes.sh -y > noi-storage.yaml
Delete script usage
./deleteStorageAllNodes.sh -h This script will delete PVCs, PVs, Storage Classes and directories created by ./createStorageAllNodes.sh Usage: ./deleteStorageAllNodes.sh [-sy] [ -s silent mode ] [ -y yaml only ] [ -h help ]
Troubleshooting
Default namespace
The script is intended to run in the default namespace. When you run the script in a different namespace, ensure that the namespace has the correct privileges to create the following Kubernetes artifacts:- Storage classes
- PVs
- Directories
Alpine linux
The script requires thealpine image in order to create directories on worker nodes. If the cluster does not have a connection to docker hub, the createStorageAllNodes.sh script hangs:
Script hangs when PVs are deleted.
First, check that there are no PVCs bound to the PV, as these bound PVCs prevent the PV from being deleted. Second, editing the PV and removing the finalizer allows the PVC to be deleted, for example:
kubectl patch pv [name] -p '{"metadata":{"finalizers":null}}'
Multiple PVs can be deleted with the following command:
kubectl get pv | cut -f1 -d' ' | grep [release] | grep -v NAME | xargs kubectl patch pv -p '{"metadata":{"finalizers":null}}'