Kubernetes Ingress
  • 22 May 2022
  • 1 Minute to read
  • Dark
    Light

Kubernetes Ingress

  • Dark
    Light

We are going to use Nginx as Ingress and install it via Helm.

Install HELM

Run the following commands to install helm.

wget -qO- https://get.helm.sh/helm-v3.8.2-linux-amd64.tar.gz | tar zxvf - 
cd linux-amd64/
./helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
./helm repo update
./helm install ingress-nginx ingress-nginx/ingress-nginx

Or you can install it via the APT tool.

curl https://baltocdn.com/helm/signing.asc | sudo apt-key add -
sudo apt-get install apt-transport-https --yes
echo "deb 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
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update
helm install ingress-nginx ingress-nginx/ingress-nginx

Make sure everything is working correctly with the following command.

kubectl get pods -n default | grep "ingress"

Run the following commands

  1. kubectl create -f https://raw.githubusercontent.com/ant-media/Scripts/master/kubernetes/ams-k8s-mongodb.yaml
  2. Edit the following YAML file according to MongoDB's IP address and run the create command. kubectl create -f https://raw.githubusercontent.com/ant-media/Scripts/master/kubernetes/ams-k8s-deployment.yaml
  3. kubectl create -f https://raw.githubusercontent.com/ant-media/Scripts/master/kubernetes/ams-k8s-hpa.yaml
  4. kubectl create -f https://raw.githubusercontent.com/ant-media/Scripts/master/kubernetes/ams-k8s-ingress.yaml
  5. kubectl create -f https://raw.githubusercontent.com/ant-media/Scripts/master/kubernetes/ams-k8s-rtmp.yaml

To install an SSL certificate

  1. kubectl create secret tls ${CERT_NAME} --key ${KEY_FILE} --cert ${CERT_FILE}
  2. kubectl create secret tls antmedia-cert --key="ams.key" --cert="ams.crt"

If everything is fine, the output of kubectl get ingress will be as follows. So the ADRESS column must have appeared a Public IP address.

root@kubectl:~# kubectl get ingress
NAME               CLASS    HOSTS               ADDRESS       PORTS     AGE
ant-media-server   <none>   test.antmedia.io   146.59.2.42   80, 443   94m

Was this article helpful?

What's Next