Build against minikube cluster Docker daemon.
minikube start
eval $(minikube docker-env)
# once
for role in queue base subscriber; do
docker build -t eventhandler/$role docker/$role
done
Run inside the minikube cluster.
kubectl create -f cluster.yaml
# or, later,
kubectl replace --force -f cluster.yaml
Inspect the components' behavior with, e.g.
kubectl logs --tail=0 <pod>
Find out public queue socket in cluster for building NATS URL. Since nats_url
is configured in the config file, we have to override it using the appropriate environment variable.
cluster_ip=$(minikube ip)
node_port=$(kubectl get services/eventhandler-queue -o go-template='{{(index .spec.ports 0).nodePort}}')
nats_url="nats://$cluster_ip:$node_port"
# git clone, go build etc.
export NATS_URL=$nats_url
export RECIPIENT=<subscriber pod>
./eventhandler publish --payload='{"check_name": "check_foo"}'
Build (against your local Docker daemon).
# once
for role in base publisher; do
docker build -t eventhandler/$role docker/$role
done
And run. CLI args following the container name are passed through to the publisher.
docker run -e NATS_URL=$nats_url eventhandler/publisher --payload='{"check_name": "check_foo"}'