i want to self host on kubernetes using aws, i wan...
# ask-ai
c
i want to self host on kubernetes using aws, i want to incldue sip server as well as part of the deployment, how?
t
Thanks for reaching out, ZaidKaraymeh. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
To self-host LiveKit on Kubernetes using AWS and include a SIP server, here’s a friendly step-by-step guide to help you out: 1. Prerequisites • Make sure you have an AWS EKS cluster up and running. • Have Helm installed on your machine. • Set up a Redis instance for LiveKit to use. • Get your SSL certificates ready for your domain and TURN/TLS. • Install the AWS Load Balancer Controller to support ALB. 2. Deploy LiveKit Server 1. Add the LiveKit Helm repository and create a
values.yaml
file with your settings like Redis address, TURN configuration, and load balancer type. 2. Then, install the LiveKit Helm chart using this command:
helm install livekit-server livekit/livekit-server --namespace <your-namespace> --values values.yaml
3. Deploy SIP Server 1. Create a Kubernetes deployment for your SIP server, making sure to specify the necessary ports (like 5060 for SIP signaling and 10000-20000 for media). 2. Set up a Kubernetes Secret for your SIP config, including API keys and Redis details. 3. Apply both the deployment and secret using
kubectl apply
. 4. Network Configuration • Expose your SIP server with a LoadBalancer or Ingress. • Update your AWS Security Groups to allow traffic on the needed ports (for example, 5060, 10000-20000, 50000-60000). 5. SSL Certificates and DNS • Import your SSL certificates into Kubernetes Secrets. • Configure DNS records for both your LiveKit and SIP server domains. 6. Additional Considerations • Consider enabling autoscaling for your LiveKit Server to handle load smoothly. • Set up monitoring for your LiveKit and SIP pods to keep an eye on performance. • Use IAM roles and security groups to keep your EKS cluster secure. If you’d like, I’m here to help with any part of this or provide more details—just let me know! Sources: examples/server-eks.yaml | Deploy to Kubernetes | LiveKit Docs
c
give me a sample file with livekit server, ingress, egress, sip, redis, and ALB load balancer, and steps to deploy
t
Here is a sample Kubernetes configuration file and some easy-to-follow steps to deploy LiveKit with server, ingress, egress, SIP, Redis, and an ALB load balancer: Sample Configuration File (values.yaml)
Copy code
# values.yaml
replicaCount: 2

livekit:
  rtc:
    use_external_ip: true
  redis:
    address: <redis-host>:6379
  keys:
    <your-api-key>: <your-secret>
  turn:
    enabled: true
    domain: <your-turn-domain>
    tls_port: 3478
    secretName: <turn-tls-secret>

loadBalancer:
  type: alb
  tls:
    - hosts:
        - <your-primary-domain>

resources:
  limits:
    cpu: 7500m
    memory: 2048Mi
  requests:
    cpu: 7000m
    memory: 1024Mi

# Egress Configuration
egress:
  api_key: "server-api-key"
  api_secret: "server-api-secret" 
  ws_url: "<ws://livekit-host:<port>>"
  log_level: info
  redis:
    address: <redis_host:port>
  s3:
    access_key: "access_key"
    secret: "secret"
    region: "us-west-2"
    bucket: "my-egress"

# Ingress Configuration
ingress:
  api_key: "server-api-key"
  api_secret: "server-api-secret"
  ws_url: "<ws://livekit-host:<port>>"
  rtmp_port: 1935
  whip_port: 8080
  serviceType: "LoadBalancer"
Deployment Steps 1. First, add the LiveKit Helm repository by running:
Copy code
helm repo add livekit <HELM_REPO_URL>
helm repo update
2. Then, install the LiveKit server using your configuration file:
helm install <instance_name> livekit/livekit-server --namespace <namespace> --values values.yaml
Just remember to swap out <HELM_REPO_URL> with the correct Helm repository URL for LiveKit. If you have any questions or want help with more configurations, feel free to ask—I'm here to help! Sources: Kubernetes &amp; Helm Charts | livekit/livekit_composite | DeepWiki | examples/server-do.yaml
c
where is the sip? i dont see it
t
You're absolutely right—the configuration I shared earlier doesn’t include the SIP server. No worries though! Here’s an example setup to deploy a SIP server alongside LiveKit: SIP Server Deployment Configuration
Copy code
# sip-server-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: livekit-sip-server
spec:
  replicas: 1
  selector:
    matchLabels:
      app: livekit-sip-server
  template:
    metadata:
      labels:
        app: livekit-sip-server
    spec:
      containers:
      - name: livekit-sip-server
        image: livekit/sip-server:latest
        ports:
        - containerPort: 5060
        - containerPort: 10000-20000
        volumeMounts:
        - name: config
          mountPath: /etc/livekit-sip/
      volumes:
      - name: config
        secret:
          secretName: sip-config
---
# sip-config-secret.yaml
apiVersion: v1
kind: Secret
metadata:
  name: sip-config
type: Opaque
data:
  config.yaml: |
    api_key: <your-api-key>
    api_secret: <your-api-secret>
    ws_url: <ws://livekit-server:7880>
    redis:
      address: <redis-host>:6379
    sip_port: 5060
    rtp_port: "10000-20000"
Steps to Deploy 1. Create the SIP configuration secret:
kubectl apply -f sip-config-secret.yaml
2. Deploy the SIP server:
kubectl apply -f sip-server-deployment.yaml
3. Expose the SIP server using a LoadBalancer or Ingress to allow external access. If you have any questions or want me to walk you through any part of this, just let me know—I’m here to help!
c
i want to have minimum and maximum replcias for livekit nodes, i know there is gonna be one pod per node, is that correct? i want minimum 3, max 20, and it creates a new pod at 70% usage
t
To set up minimum and maximum replicas for your LiveKit nodes with autoscaling based on 70% CPU usage, you can use this configuration in your Helm chart:
Copy code
autoscaling:
  enabled: true
  minReplicas: 3
  maxReplicas: 20
  targetCPUUtilizationPercentage: 70
Just a couple of things to keep in mind: • Each pod will run on its own node since LiveKit is built to scale horizontally. • Make sure CPU and memory resources are properly set in your deployment so Kubernetes can handle scaling smoothly. If you have any questions or want help with this setup or anything else, just let me know! I'm here to help. Sources: livekit-server/values.yaml | Self-hosting the Ingress Service | LiveKit Docs