You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 13 Next »

Overview

Order of Operations

  1. MongoDB must be running first
  2. Next, start the RabbitMQ
  3. Then, start Clowder itself
  4. Optional: Finally, start any extractors that you want
    1. You may need to give Clowder 10-15 minutes to discover this change.
  5. Verify that the extractors are registered to Clowder by navigating to: CLOWDER_URL:PORT/api/status
    1. You should see the extractors show up in their respective section after several minutes.

Bootstrapping Clowder in Kubernetes

Step 0: Clone Source Repository

git clone https://github.com/nds-org/nds-labs
cd nds-labs/
git fetch --all
git checkout lambert-dev

TODO: Once this is pushed up to master, remove the "checkout" step.

Step 1: Bring up an empty cluster

From the project root, execute the following command to bring up a blank cluster:

. ./cluster/k8s/localdev/kube-up-local.sh

Step 2: Bring up all services

This step MUST be done before the controllers can be started. Create the 3 necessary services using the following command:

kubectl create -f services/

Why must this be done first?

Starting these services creates a bunch of environment variables containing ip/port/protocol of the service that are then injected into controllers/pods that match the selector. Any pods started after these services will have these environment variables injected into their pod's environment. This allows us to set values in the controller specification(s) like this one, for example:

        - name: RABBITMQ_URI
          value: "amqp://guest:guest@$(CLOWDER_RABBITMQ_PORT_5672_TCP_ADDR):$(CLOWDER_RABBITMQ_PORT_5672_TCP_PORT)/%2F"

Step 3: Bring up any controllers (in order)

1.)  To bring up a MongoDB controller and pod, run the following command:

kubectl create -f controllers/mongodb-controller.yaml

 

2a.)  (Optional) Run this command to start ElasticSearch

kubectl create -f controllers/elasticsearch-controller.yaml

 

2b.)  Run this command to start RabbitMQ:

kubectl create -f controllers/rabbitmq-controller.yaml

 

3.)  (Optional) After starting RabbitMQ, run commands similar to the following in order to start your extractors:

kubectl create -f controllers/EXTRACTOR-1-controller.yaml
kubectl create -f controllers/EXTRACTOR-2-controller.yaml
   .   .   .
kubectl create -f controllers/EXTRACTOR-N-controller.yaml

 

4.)  Run this command last to bring up Clowder itself:

kubectl create -f controllers/clowder-controller.yaml

Step 4: Clowder GUI

Wait a minute or so for Clowder to start. Once it has started, you should be able to navigate your browser to port 30291 of your OpenStack VM's IP.

Clowder's controller specification describes a "NodePort" (port 30291) that exposes our cluster to the public internet.

Stopping the Cluster

To shut down the cluster, simply perform all steps above in reverse with delete instead of create.

From the services/ncsa/clowder, execute the following commands to shut down the whole cluster:

kubectl delete -f controllers/
kubectl delete -f services/
cd ../../..
. ./cluster/k8s/localdev/kube-down-local.sh

Tip and Tricks

Helper Scripts

A few helper scripts are available in ${baseDir}/cluster/k8s/localdev/ to assist with debugging pods.

These scripts assume:

  • The entire cluster is running locally
  • Only a single pod replica per controller 
  • Containers inside of controlled pods must have a name that matches the pod's template
    • For example, if RC creates pods that named clowder-clowder-HASH, the scripts can only attempt to read the clowder-clowder container within this pod.

env.sh

A naive script to save some typing whilst debugging service/pod linkage, this script will print any environment variables present in the target container.

Example usage:

. env.sh clowder-clowder

The above command will locate the clowder-clowder-* pod and, assuming there is only one, print out the environment variable's from the clowder-clowder container within the pod.

exec.sh

A naive script to save some typing whilst debugging service/pods in general, this script will execute an arbitrary command in the target container.

Example usage:

. exec.sh clowder-clowder "curl -L localhost:9000"

The above command will locate the clowder-clowder-* pod and, assuming there is only one, will execute the given command inside of the clowder-clowder container within the pod.

logs.sh

A naive script to save some typing whilst debugging service/pods in general, this script will display the logs from the target container

Example usage:

. logs.sh clowder-clowder

The above command will locate the clowder-clowder-* pod and, assuming there is only one, will print out the logs of the clowder-clowder container within the pod.

Scaling Extractors

Use the following command to scale up or down an extractor on the fly:

kubectl scale --current-replicas=1 --replicas=2 rc clowder-image-preview

NOTE: --current-replicas is optional, but highly recommended when scaling down a controller.

NOTE: --replicas=0 is an acceptable value, allowing you to start a controller without starting its pods right away.

Hot-swapping Extractors

As you bring up and take down extractors, they will (every few minutes or so) automagically register / unregister themselves from Clowder. Based on the behavior, this is likely done via a polling process. 

If you are trying to modify which extractors you are currently using, be sure to give Clowder up to 15 minutes to discover the change.

 

  • No labels