Awesome
rabbitmq-example
This repo serves as an example for :
Rabbitmq-operator
This operator creates a rabbitmq service, and puts the credentials in a secret. This secret will then be used in the deployment to allow our script to access the instances.
Rabbitmq
This example is split into 2 parts, sender and receiver, and works as follows:
- Get the user and secret from the environment
- Connect to rabbimq
- Ensure the queue exists
- Push or pop from the queue
This example takes strong inspiration from the official tutorial.
Skaffold
Skaffold allows us to easily develop an application that will run on kubernetes. As we will be running a sender and receiver, we will need to describe both.
For our example, 5 files are needed:
- skaffold.yaml
- k8s-deploy-{receiver,sender}.yaml
- docker/Dockerfile.{receiver,sender}
skaffold.yaml
Skaffold configuration, describes the two images we will have to build, and the kubernetes maniifest to deploy them.
When run with
skaffold dev
skaffold will watch the files in the repo and redeploy when necessary. It is advised to run this in a separate terminal.
k8s-deploy-{receiver,sender}.yaml
K8s deployment, will launch our image with the credentials stored in the secret generated by the rabbitmq-operator.
docker/Dockerfile.{receiver,sender}
Dockerfile to run our script.
Usage
For development:
NAMESPACE="test-rabbitmq"
kubectl -n $NAMESPACE apply -f ./simple.yaml
skaffold -n $NAMESPACE dev
For deployment:
NAMESPACE="test-rabbitmq"
kubectl -n $NAMESPACE apply -f ./simple.yaml
skaffold -n $NAMESPACE run