Skip to main content
Deepgram's Docs

Search documentation

Type to search this documentation.

On this pageOverview

Self-Managed Kubernetes

Prior to deploying Kubernetes you will need to ensure you have a suitable environment per our Deployment Environments guide. You will also need access to the deepgram-self-hosted Helm chart.

If you are not overly familiar with Kubernetes, you should be aware of three main concepts:

  • Node: A physical computer or virtual machine used to host workloads.
  • Pod: A single container running on a node. One node can host many pods.
  • Cluster: A group of nodes and their associated pods.

Additionally this guide refers frequently to kubectl, the command line tool for interacting with the Kubernetes clusters, kubeadm, the cluster administration tool, and the kubelet node agent.

Kubernetes consists of several components distributed as binaries or container images including an API server for cluster management, proxy server, scheduler, controllers, etc. These components are served from registry.k8s.io, and you will require several helper tools to get up and running including the aforementioned kubectl, kubeadm, and kubelet. Prior to installing Kubernetes you must disable Linux swap permanently. While sudo swapoff -a will temporarily disable swap, you will need to make the change permenent in /etc/fstab or systemd.swap.

Update your package repositories and install dependencies for the Kubernetes repository:

Bash

Download the public signing key from Google:

Bash

Note: Distributions prior to 22.04 may not have the /etc/apt/keyrings folder. You can create this directory, making it world-readable and writeable only by admins. Add the Kubernetes official repository:

Bash

Update packages and install Kubernetes tools:

Bash

In order to run nodes and pods you must first create a cluster. This is done using the kubeadm command:

Bash

Kubeadm will run verification checks and report any errors, then it will download the required containerized components and initialize a control-plane. You can see configuration options for initialization here, including how set node taints.

Once the control-plane is initialized you will receive instructions to store the cluster configuration and deploy a pod network. Examples below (instructions may differ based on your system):

Bash

You will also be presented with a kubeadm join command which should be saved for later use joining worker nodes to the master node. Upon completion you should now be able to query your control-plan and see the standard Kubernetes pods running:

Bash

By default Kubernetes does not deploy a CNI for pod communication. Before cluster DNS will start and pods be able to communicate you must install an add-on for the CNI you wish to deploy in your cluster as follows:

Bash

As an example, if you were to deploy the Calico network in your cluster you would install the add-on as follows:

Bash

A comprehensive though not exhaustive list of common network add-ons is available in the official Kuberenetes Networking and Network Policy documentation. You may utilize only a single CNI per cluster. To verify the network is up and running you can check the CoreDNS pod status. When the CoreDNS pod state shows as Running you may then join nodes to the cluster.

Once the master node is setup you can begin joining worker nodes to the cluster. If you copied the join command output when the cluster was initialized this can be used on each worker node directly. In the event that you did not save the join command you may recover it using kubeadm as follows:

Bash

After joining nodes to the cluster you can utilize the kubectl command to verify the status of the cluster nodes:

Bash

Kubernets supports metric aggregates from nodes within the cluster, however this is not setup by default upon cluster initialization. If you wish to utilize the Kubernetes metrics server you may deploy the latest version using kubectl:

Bash

After deployment you may then query the compute utilization of nodes using the top command from the CLI:

Bash

Alternatively you can consume node metrics using your own metrics aggregation service poitned to the metrics API.

Deepgram strongly recommends following best practices for configuring Kubernetes Secrets. Please refer to Securing Your Cluster for more details.

The deepgram-self-hosted Helm chart takes two Secret references. One is a set of distribution credentials that allow the cluster to pull images from Deepgram’s container image repository. The other is your self-hosted API key that licenses each Deepgram container that is created.

  1. Complete the Self Service Licensing & Credentials guide to generate distribution credentials and a self-hosted API key.

  2. If using an external Secret store provider, configure cluster access to these two Secrets, naming them dg-regcred (distribution credentials) and dg-self-hosted-api-key.

  3. If not using an external Secret store provider, create the Secrets manually in your cluster.

    1. Using the distribution credentials username and password generated in the Deepgram Console, create a Kubernetes Secret named dg-regcred.

      Bash
    2. Create a Kubernetes Secret named dg-self-hosted-api-key to store your self-hosted API key. /

      Bash

Your Deepgram Account Representative should provide you with download links to at least one voice AI model. Copy the provided model files into a dedicated directory on the host machine.

Bash

Create a local PersistentVolume in your cluster using this official Kubernetes guide, and set the spec.local.path to the absolute path of the deepgram-models directory you just created.

Deepgram maintains the official deepgram-self-hosted Helm Chart. You can reference the source and Artifact Hub listing for more details. We’ll use this Chart to facilitate deploying Deepgram services in your self-hosted environment.

  1. Fetch the repository info.

    Bash
  2. Download a values.yaml template from Deepgram’s self-hosted resources. For example, here is a template for a basic setup with a self-managed cluster.

  3. In your values.yaml, modify the scaling.replicas.{api,engine} as desired.

  4. In your values.yaml file, insert the name of your local PersistentVolume you created in the previous section.

    YAML
    engine:
      modelManager:
        volumes:
          customVolumeClaim:
            enabled: true
            name: deepgram-models-pv # Replace with the name of the local PersistentVolume you have created
            modelsDirectory: "/"
  5. Install the Helm Chart with your values.yaml file.

    Bash

Test Your Deepgram Setup with a Sample Request

Section titled “Test Your Deepgram Setup with a Sample Request”

Test your environment and container setup with a local file.

  1. Get the name of one of the Deepgram API Pods.

    Bash
  2. Launch an ephemeral container to send your test request from.

    Bash
  3. Inside the ephemeral container, download a sample file from Deepgram (or supply your own file).

    Bash
  4. Send your audio file to your local Deepgram setup for transcription.

    Bash

You should receive a JSON response with the transcript and associated metadata. Congratulations - your self-hosted setup is working!

Your Deepgram services are accessible within your cluster via the deepgram-api-external Service that was created by the Helm Chart.


What’s Next

Now that you have a basic Deepgram setup working, take some time to learn about building up to a production-level environment, as well as helpful Deepgram add-on services.

Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu