Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mauri870/asterisk-service-discovery
An example of running Asterisk nodes on Kubernetes with service discovery using Etcd
https://github.com/mauri870/asterisk-service-discovery
asterisk docker-compose etcd kubernetes service-discovery
Last synced: 7 days ago
JSON representation
An example of running Asterisk nodes on Kubernetes with service discovery using Etcd
- Host: GitHub
- URL: https://github.com/mauri870/asterisk-service-discovery
- Owner: mauri870
- Created: 2017-12-10T14:53:24.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-12-10T15:10:27.000Z (about 7 years ago)
- Last Synced: 2024-11-07T19:52:54.656Z (about 2 months ago)
- Topics: asterisk, docker-compose, etcd, kubernetes, service-discovery
- Language: Shell
- Homepage:
- Size: 20.5 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### Asterisk Service Discovery with Etcd
```bash
asterisk - Simple asterisk images
etcd-node - Simple nodejs app to retrieve the available nodes from etcd
k8s - Kubernetes config files
```> A more concrete nodejs example can be found [here](https://github.com/dougbtv/vnf-asterisk-controller)
### Docker compose
```bash
docker-compose up -d
docker-compose exec etcd-node node index # open in a new tab
# You should see one asterisk in the app logs.
# If you bring the asterisk server down you will see that the server is also deleted from the app(and etcd too).
docker-compose stop asterisk
```### Kubernetes
The kubernetes example is more interesting because we can see how the proccess of scaling and destroying pods happens and how the pods communicate with etcd.
> You need to install `kubectl` and `minikube`
```bash
docker build -f asterisk/Dockerfile.alpine -t asterisk-discovery ./asterisk
docker build -f etcd-node/Dockerfile -t node-discovery ./etcd-node
```Now we need to transfer our local images to the minikube VM. This can take a while.
```bash
minikube start
for image in asterisk node
do
docker save $image-discovery | ssh -o UserKnownHostsFile=/dev/null \
-o StrictHostKeyChecking=no -o LogLevel=quiet \
-i ~/.minikube/machines/minikube/id_rsa docker@$(minikube ip) docker load
done
``````bash
kubectl create -f k8s
kubectl get pods # get the respective pod name
kubectl logs -f node-[pod id] # wait until nodes are displayed on logs
kubectl scale rc asterisk --replicas=4 # you should see a new server on the node logs after some time
kubectl scale rc asterisk --replicas=2
kubectl delete -f k8s
```