Try Live Demo

Helm is a powerful tool that simplifies the management of applications on Kubernetes. With Helm, you can easily deploy, upgrade, and control versions of your applications, all with just a few simple commands.

This post will guide you through the steps of deploying Ant Media Server to Kubernetes using Helm. But what I find the most exciting, is that you can create an Ant Media Server Cluster environment with just one click!

Helm supports installations on Ubuntu and other distros. Before installing Helm on any operating system, it is necessary to set up a Kubernetes cluster.

If Helm is not installed on your computer, you can follow the steps below for Ubuntu 20.04 and check this link for other distro downloads.

Prerequisites

  • Kubernetes >= 1.23 (Your cluster must be ready and accessible)
  • Helm v3
  • cert-manager

Installing Helm

Install the helm tool by executing the commands below.

curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | sudo tee /usr/share/keyrings/helm.gpg > /dev/null
sudo apt-get install apt-transport-https --yes
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list
sudo apt-get update
sudo apt-get install helm

Install the Ant Media Server Helm Chart

Helm charts are used to describe what needs to be installed on the Kubernetes cluster using Helm.

The chart contains all the necessary information about the application or service, including its dependencies, configuration settings, and resource requirements.

When you use Helm to install an application, it reads the chart and installs all the required components onto the Kubernetes cluster.

Ant Media Server Helm chart installs the following:

  • MongoDB deployment
  • Origin deployment
  • Edge Deployment
  • Ingress controller

To get started, add the Ant Media Server repository to Helm and then install it as follows.

helm repo add antmedia https://ant-media.github.io/helm
helm repo update
helm install antmedia antmedia/antmedia --set origin={origin}.{example.com} --set edge={edge}.{example.com} --namespace antmedia --create-namespace

After the installation is finished you’ll have:

  • 1 MongoDB pod
  • 1 Ant Media Origin pod
  • 1 Ant Media Edge pod
  • Nginx Ingress will be installed (Go to the bottom of the page for available parameters.)

The output of kubectl get pods -n antmedia will be as follows.

NAME                                                 READY   STATUS    RESTARTS   AGE
ant-media-server-edge-7d8fd58f94-dwqbs               1/1     Running   0          2m15s
ant-media-server-origin-57d974f4f7-655rf             1/1     Running   0          2m15s
antmedia-ingress-nginx-controller-6b49f64bfc-zbblx   1/1     Running   0          2m15s
mongo-69888cbbb9-d2zrc                               1/1     Running   0          2m15s

If the installation went as expected, run kubectl get ingress -n antmedia command to get your Ingress IP address and then update your DNS according to the ingress IP address and hostnames.

kubectl get ingress -n antmedia

Example Output

NAME                      CLASS    HOSTS                   ADDRESS        PORTS     AGE
ant-media-server-origin   <none>   origin.antmedia.cloud   x.x.x.x        80, 443   9m45s
ant-media-server-edge     <none>   edge.antmedia.cloud     x.x.x.x        80, 443   9m55s

You can do a DNS query as follows.

dig origin.antmedia.cloud +noall +answer
dig edge.antmedia.cloud +noall +answer

Example output:

root@murat:~# dig edge.antmedia.cloud +noall +answer
edge.antmedia.cloud.	300	IN	A	x.x.x.x

If the result of this output is your Ingress IP address, your DNS has been updated so you can access via HTTPS (self-signed) or HTTP.

Install SSL

By default, a self-signed certificate comes in the Ant Media Server Kubernetes structure that you install with Helm. If you prefer, you can replace it with your own certificate or follow the steps below for a free Let’s Encrypt certificate.

Install Custom Certificate

kubectl create -n antmedia secret tls ${CERT_NAME} --key ${KEY_FILE} --cert ${CERT_FILE} 

Install Let’s Encrypt Certificate

This can all be done using a script we have prepared below or a step-by-step installation.

wget https://raw.githubusercontent.com/ant-media/helm/add_helm_repo/ams-k8s-ssl.sh
bash ams-k8s-ssl.sh

Then wait for the certificate to be created.

If everything went well, the output of the kubectl get -n antmedia certificate command will show the value True as follows.

NAME                   READY   SECRET                 AGE
antmedia-cert-origin   True    antmedia-cert-origin   21m
antmedia-cert-edge     True    antmedia-cert-edge     24m

Then you can reach the Ant Media Edge/Origin instances over HTTPS.

https://{origin}.{example}.{com}
https://{edge}.{example}.{com} 

Parameters

You can customize the Ant Media Cluster installation using the following parameters.

Parameter Description Default
image image repository antmedia/enterprise:latest
origin Domain name of Origin server {}
edge Domain name of Edge server {}
hostNetwork If false, use turn server true
mongodb MongoDB host mongo
autoscalingOrigin.targetCPUUtilizationPercentage Target CPU utilization percentage for autoscaler for Origin 60
autoscalingOrigin.minReplicas Minimum number of deployment replicas for the compute container 1
autoscalingOrigin.maxReplicas Maximum number of deployment replicas for the compute container 10
autoscalingEdge.targetCPUUtilizationPercentage Target CPU utilization percentage for autoscaler forEdge 60
autoscalingEdge.minReplicas Minimum number of deployment replicas for the compute container 1
autoscalingEdge.maxReplicas Maximum number of deployment replicas for the compute container 10

Example Usage

helm install antmedia antmedia/antmedia --set origin=origin.antmedia.io --set edge=edge.antmedia.io --set autoscalingEdge.targetCPUUtilizationPercentage=20 --set autoscalingEdge.minReplicas=2 --namespace antmedia --create-namespace

Here above you can check our latest video about how to make an auto-scaling cluster with helm.


Murat Ugur

Murat is a Software Developer and a Technical Support Engineer at the same time at Ant Media. With a remarkable 15+ years in the IT domain, including 13 years dedicated to Linux System administration, Murat brings a wealth of experience to the table. His expertise is grounded in technologies like bash scripting, python, and puppet.

chatsimple
Warning: Undefined array key "promocode" in /home/mirror.antmedia.io/public_html/wp-content/themes/hestia-child/footer.php on line 70