how to Deploy LiveKit to Kubernetes. (self hosting...
# ask-ai
p
how to Deploy LiveKit to Kubernetes. (self hosting) and is it necessarily needs a domain for the deployment? I need to be on-prem fully
t
Thanks for reaching out, Yasser. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! If you're looking to deploy LiveKit to Kubernetes for self-hosting, the good news is that the provided Helm chart makes things a lot easier. Let me walk you through the basics: What you’ll need before getting started: • A Kubernetes cluster (think AWS, GKE, Digital Ocean, or similar). • Helm installed on your machine. • A domain and SSL certificates to keep things secure. • A Redis instance up and running. Here’s how to deploy: 1. Add the LiveKit Helm repository: `helm repo add livekit <HELM_REPO_URL>`Just swap out
<HELM_REPO_URL>
with the right URL for your Helm repo. 2. Create a
values.yaml
file where you’ll set things like the Redis address, API keys, TURN settings, and load balancer options. 3. Import your SSL certificates into Kubernetes secrets:
kubectl create secret tls <name> --cert <cert-file> --key <key-file> --namespace <namespace>
4. Install LiveKit with Helm:
helm install <instance_name> livekit/livekit-server --namespace <namespace> --values values.yaml
5. Don’t forget to check your firewall settings to make sure the right ports are open. Some important things to keep in mind: • You’ll need a domain since it acts as the main endpoint for SDK connections. • SSL certificates are a must for secure communication. • Make sure your TURN/TLS and load balancer settings are correctly configured in your
values.yaml
file. If any of this feels tricky or you want a hand with any step, just give me a shout—I’m here to help! Sources: Deploy to Kubernetes | LiveKit Docs | Deploy to Kubernetes | LiveKit Docs
p
is the domain necessary? what if i put internal ip instead
t
Great news! You can definitely deploy LiveKit using an internal IP instead of a domain, though it does need a few specific tweaks to make sure everything routes smoothly within your private network. Here’s a friendly guide to help you get it set up: Steps to Use an Internal IP: 1. Use the
<http://external-dns.alpha.kubernetes.io/internal-hostname|external-dns.alpha.kubernetes.io/internal-hostname>
annotation in your Service or Ingress resource to point to your internal DNS records. This will link to the internal IP. 2. If you’re working with a Service of type
LoadBalancer
or
ClusterIP
, configure it to use the internal IPs of your nodes. 3. For Ingress, just specify the internal hostname right in the annotations to make sure traffic goes to the internal IP. 4. Here’s a quick YAML example: `metadata: annotations: external-dns.alpha.kubernetes.io/internal-hostname: internal.example.com`This sets up an internal DNS record using your internal IP. 5. Don’t forget to tweak your Helm chart values to include those internal hostnames. You can check out the
server-sample.yaml
file for some handy configuration ideas. 6. Make sure your Service type (
LoadBalancer
,
NodePort
, or
ClusterIP
) is set up just right. If you’re using
NodePort
, you might need to specify whether to use public or private IPs. Follow these steps, and you’ll have LiveKit up and running on an internal IP in no time. If you hit any bumps or want a hand with anything else, just let me know—I’m here to help! Sources: docs/sources/service.md | gclb-sample.yaml
p
what about the api key and secret is it will be auto generated in this case
t
Just a heads-up: the API key and secret aren’t automatically created when you deploy LiveKit to Kubernetes, even if you’re using an internal IP. You’ll need to generate them yourself and add them to your deployment setup. Here’s how you can do it: 1. Run this command to generate your API key and secret: `livekit-server generate-keys`Make sure to save the key and secret somewhere safe! 2. Add those credentials to your Kubernetes config. For example, if you’re using the Helm chart, put them in the
keys
section of your
values.yaml
file like this:
Copy code
livekit:
  keys:
    your-api-key: your-api-secret
3. Or, if you prefer, you can set these up using environment variables or Kubernetes secrets for a more secure approach. If you want, I’m here to help you through any of these steps—just let me know!