From 0b3d386f05cd5834f469c76066e6953ac2d94b28 Mon Sep 17 00:00:00 2001 From: Aditya Patawari Date: Mon, 4 Apr 2016 15:44:52 +0530 Subject: [PATCH] adding kubernetes artifects --- kubernetes/README.md | 42 ++++++++++++++++++++++++ kubernetes/restcomm_rc.yml | 65 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 kubernetes/README.md create mode 100644 kubernetes/restcomm_rc.yml diff --git a/kubernetes/README.md b/kubernetes/README.md new file mode 100644 index 0000000..96e7664 --- /dev/null +++ b/kubernetes/README.md @@ -0,0 +1,42 @@ +Kubernetes artifects +================== + +The Kubernetes replication controller assumes that you have a running Kubernetes environment. + +The replication controller has 5 ports of rtp open. This means that it can take 5 calls in parallel. While this may not be an ideal situation for many use-cases, currently, there is no way to open a range of ports in Kubernetes. + +Please hang tight, while we find a way to make this work or figure out another orchestration method. + +How to use this? +============== +As stated, it is assumed that you have an environment which can run contianers via Kubernetes already set up. If not, please consider either gettting Google Container engine account or check out [this getting started doc](http://kubernetes.io/docs/getting-started-guides/) for Kubernetes. + +Once you have the Kubernetes environment up, set up a replication controller. A replication controller will ensure that any containers that are in your Kubernetes pod are highly avaiable. Creating a replication controller is same regardless of your environment (Google cloud or bare metal). + +``` +$ kubectl create -f Restcomm-Docker/kubernetes/restcomm_rc.yml +replicationcontroller "restcomm-core-controller" created +``` +Let us check if the pods are up yet. + +``` +$ kubectl get pods +NAME READY STATUS RESTARTS AGE +restcomm-core-controller-cjq4q 1/1 Running 0 7m +``` +Once we see that the `STATUS` is set to `running`, we can now expose the ports to outside world. This step will vary from infrastructure to infrastructure. For Google cloud, do the following: + +``` +$ kubectl expose rc restcomm-core-controller --type=LoadBalancer +service "restcomm-core-controller" exposed +``` +The command above create a service for Google Container Enginer. It creates a load balancer and routes traffic from the load balancer to the Docker containers. If you are on any other kind of infrastructure, please create a [service](http://kubernetes.io/docs/user-guide/services/) manually for the same. +To obtainer the public IP of the load balancer, do: +``` +kubectl get svc +NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE +kubernetes 10.7.240.1 443/TCP 15m +restcomm-core-controller 10.7.240.42 104.199.139.229 80/TCP,443/TCP,9990/TCP,5060/TCP,5060/TCP,5061/TCP,5062/TCP,5063/TCP,65000/TCP,65001/TCP,65002/TCP,65003/TCP,65004/TCP 3m +``` +Notice that there an IP in `EXTERNAL-IP` columnn against `restcomm-core-controller`. Copy that and open `https://` + diff --git a/kubernetes/restcomm_rc.yml b/kubernetes/restcomm_rc.yml new file mode 100644 index 0000000..952be6f --- /dev/null +++ b/kubernetes/restcomm_rc.yml @@ -0,0 +1,65 @@ +apiVersion: v1 +kind: ReplicationController +metadata: + name: restcomm-core-controller +spec: + replicas: 1 + selector: + app: restcomm-core + template: + metadata: + labels: + app: restcomm-core + spec: + containers: + - name: restcomm-core + image: restcomm/restcomm + ports: + - name: http + containerPort: 80 + protocol: TCP + - name: https + containerPort: 443 + protocol: TCP + - name: tcp9990 + containerPort: 9990 + protocol: TCP + - name: sip-tcp + containerPort: 5060 + protocol: TCP + - name: sip-udp + containerPort: 5060 + protocol: UDP + - name: sip-tls + containerPort: 5061 + protocol: TCP + - name: sip-ws + containerPort: 5062 + protocol: TCP + - name: sip-wss + containerPort: 5063 + protocol: TCP + - name: rtp0 + containerPort: 65000 + protocol: UDP + - name: rtp1 + containerPort: 65001 + protocol: UDP + - name: rtp2 + containerPort: 65002 + protocol: UDP + - name: rtp3 + containerPort: 65003 + protocol: UDP + - name: rtp4 + containerPort: 65004 + protocol: UDP + env: + - name: ENVCONFURL + value: https://raw.githubusercontent.com/RestComm/Restcomm-Docker/master/scripts/restcomm_env_locally.sh + - name: STATIC_ADDRESS + value: 192.168.0.71 + - name: MEDIASERVER_LOWEST_PORT + value: "65000" + - name: MEDIASERVER_HIGHEST_PORT + value: "65004"