Skip to main content
Version: 2.12

Deploy Ant Media Server with Helm Charts

Helm is a tool that enables the management of applications on a Kubernetes cluster. It's possible to deploy, upgrade, and control versions using Helm.

Ant Media Server can be easily deployed to a Kubernetes cluster via Helm 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 also refer to the Helm installation documentation for other distributions.

info

You will need to have the Kubernetes command line tool and Helm that package manager for Kubernetes installed on your computer.

Visual Walkthrough: Video Guide

Prerequisites

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

Install Helm

Install the helm tool by running the following commands.

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 Helm Chart

A Helm chart is a package that contains all the necessary resources to deploy an application to a Kubernetes cluster. This includes YAML configuration files for deployments, services, secrets, and config maps that define the desired state of your application. In this case, Ant Media Server.

The Ant Media Server Helm chart installs the following:

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

Add the Ant Media Server repository to Helm and install it using the following commands.

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 there will be:

  • 1 MongoDB pod
  • 1 Ant Media Origin pod
  • 1 Ant Media Edge pod
  • Nginx Ingress will be installed (navigate to the end of this page for available parameters)

The output of the command kubectl get pods -n antmedia should be as below.

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 completed successfully, execute kubectl get ingress -n antmedia command to fetch the Ingress IP address so that the DNS records for the hostname can be updated.

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

Confirm the DNS update by making a query:

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 the expected Ingress IP address, then the DNS has been updated successfully and Ant Media Server can be accessed via HTTPS (self-signed) or HTTP.

Install SSL

By default, a self-signed certificate comes in the Ant Media Server Kubernetes structure that is installed with Helm. If required, this can be replace with a custom certificate as shown below or follow the steps in further down to install via Let's Encrypt.

kubectl create -n antmedia secret tls ${CERT_NAME} --key ${KEY_FILE} --cert ${CERT_FILE} 
Use Let's Encrypt

This can also be executed using a script through a guided installation process:

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

Expect a short pause while the certificate is being 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

Now Ant Media Server Edge/Origin instances can be accessed over HTTPS.

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

Parameters

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

ParameterDescriptionDefault
image.repositoryimage repositoryantmedia/enterprise
image.tagimage taglatest
originDomain name of Origin server{}
edgeDomain name of Edge server{}
hostNetworkIf false, use turn servertrue
mongodbMongoDB hostmongo
licenseKeyLicense key{}
autoscalingOrigin.targetCPUUtilizationPercentageTarget CPU utilization percentage for autoscaler for Origin60
autoscalingOrigin.minReplicasMinimum number of deployment replicas for the compute container.1
autoscalingOrigin.maxReplicasMaximum number of deployment replicas for the compute container.10
autoscalingEdge.targetCPUUtilizationPercentageTarget CPU utilization percentage for autoscaler for Edge60
autoscalingEdge.minReplicasMinimum number of deployment replicas for the compute container.1
autoscalingEdge.maxReplicasMaximum number of deployment replicas for the compute container.10
MongoDBNodeSelectorNode Affinity for MongoDB deployment.{}
EdgeNodeSelectorNode Affinity for AMS Edge deployment.{}
OriginNodeSelectorNode Affinity for Edge Origin deployment.{}

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