plain-hamburger-12701
09/09/2025, 10:11 AMTCP:443 inspite of providing the udp_port Any idea why ? Is this expected behaviour ? Is this reason why I am getting could not establish pc connection in a browser connected to the AWS account via VPN
replicaCount: 1
terminationGracePeriodSeconds: 18000 # 5 hours for graceful shutdown
livekit:
port: 7880
log_level: debug
http_headers:
"Access-Control-Allow-Origin": "*"
"Access-Control-Allow-Private-Network": "true"
rtc:
use_external_ip: false
port_range_start: 50000
port_range_end: 60000
tcp_port: 7881
keys:
"xxxx": "xxxxx"
turn:
enabled: true
domain: turn.dev.xxx.a-xxx.net # Your private Route 53 domain
tls_port: 443
udp_port: 3478
external_tls: true
serviceType: "LoadBalancer"
serviceAnnotations:
service.beta.kubernetes.io/aws-load-balancer-scheme: "internal"
service.beta.kubernetes.io/aws-load-balancer-type: "nlb"
service.beta.kubernetes.io/aws-load-balancer-cross-zone-load-balancing-enabled: "true"
service:
ports:
- name: turn-tls
port: 443
protocol: TCP
targetPort: turn-tls
- name: turn-udp
port: 3478
protocol: UDP
targetPort: turn-udp
podHostNetwork: true
loadBalancer:
type: alb
annotations:
kubernetes.io/ingress.class: alb
alb.ingress.kubernetes.io/scheme: "internal" # Internal ALB
alb.ingress.kubernetes.io/target-type: ip
alb.ingress.kubernetes.io/ssl-policy: ELBSecurityPolicy-TLS-1-2-2017-01
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS": 443}]'
alb.ingress.kubernetes.io/ssl-redirect: '443'
alb.ingress.kubernetes.io/subnets: "subnet-xxx,subnet-xxx,subnet-xxx"
# ACM certificate auto-discovery based on domain match
tls:
- hosts:
- voice.dev.xx.a-xxx.nettall-airline-16756
09/09/2025, 10:11 AMtall-airline-16756
09/09/2025, 10:13 AMudp_port in your values, it isn’t being reflected through the NLB due to this limitation in the Helm chart. To help you expose the TURN/UDP port on the NLB, you’ll need to make a small modification to the Helm chart’s turnloadbalancer.yaml template. Here’s a friendly step-by-step guide to walk you through it: 1. First, clone the LiveKit Helm chart repository. 2. Next, open the livekit-server/templates/turnloadbalancer.yaml file and add a new port definition under spec.ports: like this: yaml - port: 3478 targetPort: {{ .Values.livekit.turn.udp_port }} protocol: UDP If you want better compatibility with firewalls, you can instead use port 443 for UDP: yaml - port: 443 targetPort: {{ .Values.livekit.turn.udp_port }} protocol: UDP 3. Then, update your values.yaml to set the udp_port. Using port 443 for UDP is often recommended if you’re working in environments with restrictive firewalls. 4. After that, apply the modified Helm chart using helm install or helm upgrade. 5. Lastly, please make sure your AWS Security Groups allow inbound UDP traffic on the port you’ve configured (whether that’s 3478 or 443). This should help get your TURN/UDP traffic flowing through the NLB smoothly. If you have any questions or need a hand with any of these steps, just let me know—I’m here to help! Sources: Deploying LiveKit | LiveKit Docs | Ports and firewall | LiveKit Docs | Firewall Tips | livekit-server/templates/service.yamlplain-hamburger-12701
09/09/2025, 10:15 AMtall-airline-16756
09/09/2025, 10:15 AMturnloadbalancer.yaml template to include a UDP port specification comes from a few helpful sources that I'd love to share with you:
• The Helm chart's default setup for TURN services currently defines only a TCP port mapping in the turnloadbalancer.yaml template. This is why the NLB creates just a TCP listener. ()
• Best practices recommend using UDP port 443 for TURN/UDP to ensure better compatibility, especially with restrictive firewalls. ()
• There’s guidance on how to expose TURN/UDP traffic properly through AWS security groups and network ACLs, which helps maintain smooth connectivity. ()
• WebRTC’s ICE prioritization and fallback mechanisms explain how TURN/UDP is used when higher-priority options don’t work out. ()
Putting all these pieces together, it really supports the idea of updating the Helm chart and configuring the NLB to allow UDP traffic. If you’d like, I’m here to walk you through any part of this or provide more details—just let me know!plain-hamburger-12701
09/09/2025, 10:18 AMtall-airline-16756
09/09/2025, 10:19 AMturn:
enabled: true
tls_port: 443
domain: turn.myhost.com
cert_file: /path/to/turn.crt
key_file: /path/to/turn.key
With this setup, your clients can seamlessly fall back to TURN/TLS whenever UDP isn’t an option, keeping your connectivity smooth without needing a UDP listener. If you have any questions or need a hand with this, just let me know—I’m here to help! Sources: Firewall Tips | Docs::Home | config-sample.yaml | Docs::Home | Deploying LiveKit | LiveKit Docsplain-hamburger-12701
09/09/2025, 10:20 AMtall-airline-16756
09/09/2025, 10:21 AMplain-hamburger-12701
09/09/2025, 10:38 AMtall-airline-16756
09/09/2025, 10:40 AMlivekit:
turn:
enabled: true
domain: turn.yourdomain.com
tls_port: 443
secretName: livekit-turn-tls-secret
- Then, import your TURN certificate into Kubernetes as a TLS Secret:
kubectl create secret tls livekit-turn-tls-secret --cert turn.crt --key turn.key --namespace livekit
2. External TLS Termination (e.g., NLB with ACM):
- If you’re using a load balancer to handle TLS termination, just enable external_tls: true in your configuration:
turn:
enabled: true
domain: turn.yourdomain.com
tls_port: 443
external_tls: true
- In this setup, LiveKit doesn’t need cert_file or key_file because TLS is managed externally.
3. VM Deployments:
- For EC2 or other non-Kubernetes setups, tools like Caddy can help you dynamically provision certificates from Let’s Encrypt or ZeroSSL.
If you’d like, I’m happy to walk you through any of these steps or answer any questions you have! Just let me know. Sources: pkg/config/config.go | Running LiveKit on AWS | Deploy to a VM | LiveKit Docs | Deploy to Kubernetes | LiveKit Docsplain-hamburger-12701
09/09/2025, 10:41 AMtall-airline-16756
09/09/2025, 10:43 AMlivekit:
turn:
enabled: true
domain: turn.yourdomain.com # Must match the domain covered by your ACM certificate
tls_port: 3478 # Port where LiveKit listens for decrypted TURN/TLS traffic
udp_port: 443 # Recommended for firewall traversal
external_tls: true # Disable internal TLS termination; handled externally by NLB
serviceType: LoadBalancer # Ensures Kubernetes creates a LoadBalancer-type Service
Additional Steps for AWS NLB and ACM:
1. Issue Certificate via ACM: Please request or import a certificate for turn.yourdomain.com in ACM and make sure it’s properly validated.
2. Configure NLB: You’ll want to add a TLS listener on port 443 using the ACM certificate, forwarding the decrypted traffic to port 3478 (TCP) on your target group (LiveKit TURN pods).
3. Service Annotations (Optional): If you’d like, customize the NLB behavior with these annotations:
livekit:
turn:
loadBalancerAnnotations:
service.beta.kubernetes.io/aws-load-balancer-type: "nlb"
service.beta.kubernetes.io/aws-load-balancer-ssl-cert: "arn:aws:acm:region:account-id:certificate/certificate-id"
service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "443"
4. Security Groups: Be sure to allow inbound traffic on port 3478 (TCP) and port 443 (UDP) in your EC2 security groups.
5. DNS Configuration: Finally, point turn.yourdomain.com to the NLB’s DNS name.
If you have any questions or need a hand with setting up the NLB or integrating ACM, just let me know—I’m here to help! Sources: livekit-server/templates/deployment.yaml | config-sample.yaml | Deploy to Kubernetes | LiveKit Docs | Docs::Home | Deploying LiveKit | LiveKit Docsplain-hamburger-12701
09/09/2025, 10:45 AMcan you review my final config - turn:
enabled: true
domain: xx.xx.xx.a-xx.net # Your private Route 53 domain
tls_port: 443
udp_port: 3478
external_tls: true
serviceType: "LoadBalancer"
serviceAnnotations:
service.beta.kubernetes.io/aws-load-balancer-scheme: "internal"
service.beta.kubernetes.io/aws-load-balancer-type: "nlb"
service.beta.kubernetes.io/aws-load-balancer-cross-zone-load-balancing-enabled: "true"
service.beta.kubernetes.io/aws-load-balancer-ssl-cert: "arn:aws:acm:ap-southeast-2:xxx:certificate/xx-95d0-4491-9f72-xxx"
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: "tcp"
service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "443"tall-airline-16756
09/09/2025, 10:46 AMexternal_tls: true is the right move, as it tells LiveKit to expect unencrypted traffic on the tls_port (443 in your case).
• Annotations: You’ve included the annotations for the AWS NLB nicely. Specifically:
◦ service.beta.kubernetes.io/aws-load-balancer-scheme: "internal" makes sure the NLB is internal.
◦ service.beta.kubernetes.io/aws-load-balancer-type: "nlb" clearly specifies you’re using a Network Load Balancer.
◦ service.beta.kubernetes.io/aws-load-balancer-ssl-cert correctly points to your ACM certificate ARN.
◦ service.beta.kubernetes.io/aws-load-balancer-backend-protocol: "tcp" ensures the backend protocol is TCP, which is perfect.
◦ service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "443" indicates TLS termination happens on port 443.
• tls_port: Setting tls_port: 443 is valid since the NLB will handle TLS termination and forward unencrypted traffic to this port.
• udp_port: Setting udp_port: 3478 is optional but a great idea if your environment supports UDP traffic.
Additional Notes:
• Double-check that your NLB is set to terminate TLS on port 443 and forward decrypted traffic to port 443 (or your configured tls_port) on the LiveKit pods.
• Make sure the domain xx.xx.xx.a-xx.net matches the ACM certificate’s domain since this is what clients will see as the TURN endpoint.
• Confirm your security groups allow inbound traffic on port 443 (TCP) and port 3478 (UDP) if you’re using UDP.
If you’d like, I’m here to help with a deeper dive into your Helm values or any other questions you might have! Just let me know. Sources: config-sample.yaml | livekit-server/values.yaml | Deploying LiveKit | LiveKit Docs | Docs::Homeplain-hamburger-12701
09/09/2025, 10:48 AMtall-airline-16756
09/09/2025, 10:49 AMfirewall-cmd, you can run:
sudo firewall-cmd --zone public --permanent --add-port 443/tcp
sudo firewall-cmd --zone public --permanent --add-port 3478/udp
sudo firewall-cmd --reload
If you have any questions or need a hand with any of these steps, just let me know—I’m here to help! Sources: Ports and firewall | LiveKit Docs | Docs::Home | Docs::Home | Deploy to a VM | LiveKit Docs | Docs::Homeplain-hamburger-12701
09/09/2025, 11:03 AMtall-airline-16756
09/09/2025, 11:03 AMplain-hamburger-12701
09/09/2025, 12:43 PMtall-airline-16756
09/09/2025, 12:44 PMexternal_tls: true along with the right domain and certificate configuration.
• Allow TCP Fallback: In your RTC configuration, set allow_tcp_fallback: true so clients can switch to TCP or TURN/TLS if UDP isn’t working.
• Firewall Configuration: Open these important ports:
◦ TCP 443: For TURN/TLS and WebSocket signaling
◦ UDP 50000–60000: Recommended for the best WebRTC media performance
◦ TCP 7881: For ICE/TCP fallback
• Force TURN/TLS: If you’re in a restrictive network, make sure your firewall allows *.turn.livekit.cloud on TCP 443 so TURN/TLS can be used smoothly.
• Debug and Monitor: Don’t forget to use LiveKit’s debug simulation tools to test how TURN/TLS is performing and to help spot any connectivity issues.
While TURN/TLS is great for keeping you connected in tough network situations, aiming for UDP connectivity when you can will usually give you the best audio experience. If you have any questions or need a hand with this, I’m here to help! Sources: Firewall Tips | Docs::Home | Deploying LiveKit | LiveKit Docs | pkg/service/turn.go | Docs::Homeplain-hamburger-12701
09/09/2025, 12:45 PMtall-airline-16756
09/09/2025, 12:46 PMConnectionCheck class in the LiveKit SDK to help diagnose the issue. For example:
`const checker = new ConnectionCheck(url, token);
const webrtcResult = await checker.checkWebRTC();`If you don’t see any public UDP candidates, it usually means UDP traffic might be blocked.
2. Inspect ICE Candidates: During the ICE process, take a look to see if there are candidates with protocol: 'udp' and public IPs. If these are missing, UDP is probably not available.
3. Compare UDP vs TCP Performance: You can use the checkConnectionProtocol method to compare metrics like bitrate, RTT, and jitter between UDP and TCP:
const result = await checker.checkConnectionProtocol();
4. Ensure Firewall Ports Are Open: It’s important to verify that these ports are open:Also, make sure clients allow outbound UDP traffic to the LiveKit server and *.host.livekit.cloud.
◦ UDP 50000–60000: Used for WebRTC media traffic
◦ UDP 3478: Used for TURN/UDP
1. Force TURN for Testing: To test if UDP is blocked, try configuring the client to use TURN only by setting:
`connectOpts.rtcConfig = { iceTransportPolicy: 'relay' };`If the connection works only in this relay mode, it’s a strong sign that UDP is blocked.
Please feel free to reach out if you want me to walk you through any of these steps or if you have any questions along the way! I’m here to help. Sources: pkg/rtcconfig/ip.go | Connecting to LiveKit | LiveKit Docs | Diagnosing Connection Errors with Connection Test Utility | src/connectionHelper/ConnectionCheck.ts | Firewall Tipsplain-hamburger-12701
09/09/2025, 12:55 PMtall-airline-16756
09/09/2025, 12:55 PMplain-hamburger-12701
09/09/2025, 1:30 PMConnecting to signal connection via WebSocket
Connected to server, version 1.9.0.
Establishing WebRTC connection
udp xx.xx.xx.xx:52066 host (private)
tcp xx.xx.xx.xx:7881 host (private)
udp xx.xx.xx.xx:56673 host (private)
udp xx.xx.xx.xx:52554 host (private)
tcp xx.xx.xx.xx:7881 host (private)
udp xx.xx.xx.xx:51438 host (private)
Warning: error with ICE candidate: 701 Address not associated with the desired network interface. turns:xx.dev.xxx.a-xxx.net:443?transport=tcp
Warning: Server is not configured for ICE/TCP
Warning: No public IPv4 UDP candidates were found. Your server is likely not configured correctly
Can connect via TURN
Can publish audio
detected audio from microphone
published 106 audio packets
Can publish video
Error: Permission denied by system
Resuming connection after interruption
Fail
Here is the output from connection test done from https://livekit.io/connection-test .. I am in a corporate VPN when running this test on my browser and the livekit server is on aws private vpc. They are connected via direct connect / vpntall-airline-16756
09/09/2025, 1:31 PMuse_external_ip: true in your LiveKit configuration so the server advertises its public IP.
◦ Make sure UDP ports 50000–60000 (or your configured range) are open in your AWS security group.
◦ Also, open UDP port 3478 to allow TURN/UDP traffic.
• Server is not configured for ICE/TCP: This indicates the server isn’t accepting ICE connections over TCP. To fix this:
◦ Enable rtc.tcp_port in your configuration (for example, tcp_port: 7881).
◦ Confirm that TCP port 7881 is open in your AWS security group.
• Corporate VPN Considerations: VPNs can sometimes block UDP traffic, which affects connectivity. To improve this:
◦ Allow outbound traffic to *.livekit.cloud on TCP:443 and UDP:50000–60000.
◦ Enable TURN/TLS on port 443 in your LiveKit configuration to better handle restrictive environments.
Example Configuration:
rtc:
port_range_start: 50000
port_range_end: 60000
tcp_port: 7881
use_external_ip: true
turn:
enabled: true
tls_port: 443
domain: turn.yourdomain.com
cert_file: /path/to/cert
key_file: /path/to/key
If you have any questions or need a hand with these steps, just let me know—I’m here to support you! Sources: Configuring firewalls | LiveKit Docs | Connecting to LiveKit | LiveKit Docs | Docs::Home | config-sample.yaml | Ports and firewall | LiveKit Docs