Skip to content

Flussonic in Kubernetes

This article provides some general information on Flussonic in Kubernetes:

To test Flussonic in Kubernetes environment, use our media-server-operator guide

This document is relevant both for those who are new to Kubernetes and are willing to test Flussonic in this environment as well as for those who are already actively using Kubernetes in their business.

Note

This document does not cover the basics of Kubernetes, its configuration and usage. For this refer to Kubernetes Overview and Getting Started.

Essential terms and concepts

This glossary is intended for those who are unfamiliar with Kubernetes and are just beginning to learn about it. We will try to explain some Kubernetes terms and concepts to you so that you can look at them from a different perspective:

  • Kubernetes (also known as k8s) is a cluster management program, a set of standards and rules that allows to manage a complex and dynamic cluster of microservices in a unified way. You could say that Kubernetes is a cluster operating system.
  • Node is a worker machine (physical or virtual) in a Kubernetes cluster that executes containers.
  • Pod is an instance of a program running in the Kubernetes OS. This program may consist of one or more containers. Pod is the smallest deployable unit of the Kubernetes ecosystem. A Pod is a group of one or more containers running on nodes in a Kubernetes cluster. This program may consist of one or more containers.
  • Deployment is an object which declares the deployment type in Kubernetes. It makes sure that Kubernetes is running the required number of identical Pods. So, if you wanted to run multiple Pods, without Deployment you would have to manually define each Pod. Deployment is used to run stateless applications, that is, applications with no state tracking. Pods in Deployment are ephemeral, i.e. impermanent. This means that if a Pod is dropped and stops working, a new Pod will be started instead and it will not know anything about the Pod after which it was started. In Deployment Pods are interchangeable.
  • DaemonSet is an object which declares the deployment type in Kubernetes. It ensures that each Node runs exactly one copy of a Pod. Its difference from Deployment is that DaemonSet ensures that each Pod is unique. In DaemonSet Pods have their own unique identifiers which are equal to the Pod hostnames. Thus, Pods are not interchangeable. DaemonSet implies that the same hostname is assigned to a Pod regardless of the number of Pod restarts. Knowing the uniqueness of a running Pod for a large number of Pods in a cluster is extremely useful. In the context of a Flussonic DaemonSet, this means that a Flussonic instance will be running with its own license key, on its own hostname, and with its own configuration.
  • Volume is a catalog mounted in the Pod container.
  • PersistentVolume is a disk space used to store data. PersistentVolume's (also referred to as PV) lifecycle is independent of that of a Pod using it. Therefore, if a cluster crashes, PV survives. In terms of Flussonic, PersistentVolume is great for recording and storing the archive. In the case of the cloud, cloud storage is provided as PersistentVolume. In the case of hosted servers, PersistentVolumes are disks on a particular node.
  • PersistentVolumeClaim is a Pod request mechanism on PersistentVolume. PersistentVolumeClaims (also referred to as PVC) are specified in the same place as Pods. A Pod requests the storage through the PVC. Then PVC attempts to find suitable storage in a cluster.
  • ConfigMap is a type of volume containing non-confidential data in key-value pairs. In terms of Flussonic, ConfigMap stores the static Flussonic configuration. ConfigMap can be defined as a file on disk or through environment variables.
  • Secret is a type of volume (storage) containing confidential data, such as a username, a password, a license activation key, etc. In terms of Flussonic, Secret stores the edit_auth data: administrator login and password. Secret can be defined as a file on disk or through environment variables. Unlike ConfigMap, data in Secret is securely hidden.
  • Service is an object that allows you to aggregate many Pods in one place at once. It gives access via a single entry point for different Pods. With Service you gain access to the Pod group.

Aspects of setting up Flussonic in Kubernetes

Flussonic uses the data provided in the environment variables of the env field in the Pod configuration file publish.yaml to start. When it comes to sensitive data like admin login and password (edit_auth in Flussonic), Kubernetes recommends placing this information to the Secrets in Base64 strings. Credentials are pulled from the Secret to the environment (env field).

kind: Secret
metadata:
  name: test-secret
data:
# root:password
  edit_auth: cm9vdDpwYXNzd29yZA==

In order to start a Pod with your personal settings you should replace the default root:password values in the edit_auth variable with your Base64-formatted login and password.

The concepts of the configuration file for Flussonic Media Server and Kubernetes differ greatly. Kubernetes allows the creation of a Flussonic configuration file (flussonic.conf) from a directory of config files. Each of these config files represents a meaningful part of the Flussonic configuration file (flussonic.conf). Let's see how it is done.

kind: ConfigMap
metadata:
  name: streamer-presets
data:
  ports: |
    rtmp 1935;
  vod: |
    file vod {
      storage /opt/flussonic/priv;
    }
  publish: |
    template pub {
      prefix pub;
      url publish://;
    }

Here you can see the ConfigMap object (kind: ConfigMap) and with the Flussonic configuration in the data field. The configuration is broken down into multiple config parts (ports, vod, and publish). Replace the data in these config parts with your own if necessary. You can also specify the parts into which the configuration is divided.
Then the config parts are referenced in the volumes -> configMap field in the items section.

volumes:
      - name: config-templates
        configMap:
          name: streamer-presets
          items:
          - key: ports
            path: ports.conf
          - key: vod
            path: vod.conf
          - key: publish
            path: publish.conf

Each part is written in a separate .conf file and placed further in the directory of config files /etc/flussonic/flussonic.conf.d.