Skip to content

barrysolomon/Lumigo-RabbitMQ-Example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

README for RabbitMQ Kubernetes Setup with Lumigo Tracing

This setup creates several pods that host a RabbitMQ conversation between two Kubernetes pods: a producer and a consumer. The producer sends messages to a RabbitMQ service, and the consumer reads and displays them.

Prerequisites:

  • Kubernetes cluster
  • kubectl command-line tool
  • Docker
  • Access to a container registry
  • Lumigo

Setup:

0. Personalize:

Do a global search/replace <your-registry-path> with your target registry name. Should be 9 results in the following files for this project: k8/rabbitmq-producer.yaml k8/rabbitmq-consumer.yaml README.md

Search/Replace <your-lumigo-token> in this README.md with your Lumigo token found from the Lumigo UI under Settings->Tracing in the Lumigo UI

1. Install the Lumigo Kubernetes operator on your cluster via Helm if not already done so.

helm repo add lumigo https://lumigo-io.github.io/lumigo-kubernetes-operator
helm install lumigo lumigo/lumigo-operator --namespace lumigo-system --create-namespace

2. Create a Namespace:

Create a namespace called rabbitmq:

kubectl create namespace rabbitmq

7. Add Lumigo token secret:

kubectl create secret generic --namespace rabbitmq lumigo-credentials --from-literal token=<your-lumigo-token>

You can view the token to validate by running the following:

kubectl get secret lumigo-credentials -n rabbitmq -o json  | jq -r '.data.token' | base64 -d

3. Add Lumigo operator to target namespace

echo '{
      "apiVersion": "operator.lumigo.io/v1alpha1",
      "kind": "Lumigo",
      "metadata": {
        "name": "lumigo"
      },
      "spec": {
        "lumigoToken": {
          "secretRef": {
            "name": "lumigo-credentials",
            "key": "token"
          } 
        }
      }
    }' | kubectl apply -f - --namespace rabbitmq

For the Microsoft Windows command line you should to run the folllowing command

kubectl apply -f k8/lumigo.yaml -n rabbitmq

4. Deploy RabbitMQ:

To deploy RabbitMQ as a service within the rabbitmq namespace:

kubectl apply -f k8/rabbitmq-setup.yaml -n rabbitmq

5. Build Docker Images:

Producer Image Build

pushd src/producer
docker build -t <your-registry-path>/rabbitmq-producer:latest .
docker push <your-registry-path>/rabbitmq-producer:latest
popd

Consumer Image Build

pushd src/consumer
docker build -t <your-registry-path>/rabbitmq-consumer:latest .
docker push <your-registry-path>/rabbitmq-consumer:latest
popd

6. Deploy Producer and Consumer:

Deploy the producer:

kubectl apply -f k8/rabbitmq-producer.yaml -n rabbitmq

Deploy the consumer:

kubectl apply -f k8/rabbitmq-consumer.yaml -n rabbitmq

7. Add Lumigo token secret:

kubectl create secret generic --namespace rabbitmq lumigo-credentials --from-literal token=<your-lumigo-token>

You can view the token to validate by running the following:

kubectl get secret lumigo-credentials -n rabbitmq -o json  | jq -r ".data.token" | base64 -d

Usage:

The producer sends messages every 5 seconds to the RabbitMQ service. The consumer consumes and displays them.

To view logs from the producer:

kubectl logs -l app=rabbitmq-producer -n rabbitmq

To view logs from the consumer:

kubectl logs -l app=rabbitmq-consumer -n rabbitmq

Cleanup:

To remove all the deployed resources:

kubectl delete -f k8/rabbitmq-setup.yaml -n rabbitmq
kubectl delete -f k8/rabbitmq-producer.yaml -n rabbitmq
kubectl delete -f k8/rabbitmq-consumer.yaml -n rabbitmq
kubectl delete namespace rabbitmq

Validation Commands (in no particular order)

kubectl get pods -n rabbitmq

kubectl describe pod -l app=rabbitmq-producer -n rabbitmq
kubectl describe pod -l app=rabbitmq-consumer -n rabbitmq

kubectl logs -l app=rabbitmq-producer -n rabbitmq
kubectl logs -l app=rabbitmq-consumer -n rabbitmq

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors