### STUNner Pod Resource Configuration Example Source: https://docs.l7mp.io/en/stable/INSTALL Example configuration for setting resource requests and limits for STUNnerd pods within the Helm chart. This allows fine-tuning CPU and memory allocation for the dataplane. ```yaml resources: limits: cpu: 2 memory: 512Mi requests: cpu: 500m memory: 128Mi ``` -------------------------------- ### Install Development STUNner Version using Helm Source: https://docs.l7mp.io/en/stable/INSTALL Installs the development version of STUNner, tracking the latest development builds. Use with caution as stability is not guaranteed. Suitable for testing new features. ```bash helm install stunner stunner/stunner-dev --create-namespace --namespace=stunner-system ``` -------------------------------- ### Install STUNner Premium Helm Chart Source: https://docs.l7mp.io/en/stable/PREMIUM_INSTALL Deploys the premium version of STUNner using the provided Helm chart. It requires adding the STUNner Helm repository, updating it, and then installing the chart into a specified namespace, setting the customer key during installation. Ensure the customer key is kept secure. ```bash helm repo add stunner https://l7mp.io/stunner helm repo update helm install stunner stunner/stunner-premium --create-namespace --namespace=stunner-system --set stunnerGatewayOperator.customerKey="" ``` -------------------------------- ### Install turncat using Go toolchain Source: https://docs.l7mp.io/en/stable/cmd/turncat Installs the turncat binary using the standard Go toolchain and adds it to the system's PATH. This method allows for easy installation and updates. ```go go install github.com/l7mp/stunner/cmd/turncat@latest ``` -------------------------------- ### Install stunnerctl using Go Source: https://docs.l7mp.io/en/stable/cmd/stunnerctl Installs the `stunnerctl` binary using the standard Go toolchain and adds it to the system's PATH. This is the primary method for obtaining the tool. ```go go install github.com/l7mp/stunner/cmd/stunnerctl@latest ``` -------------------------------- ### Clone STUNner Example and Apply Configuration Source: https://docs.l7mp.io/en/stable/examples/neko Clones the Neko example from the STUNner GitHub repository and applies the STUNner Kubernetes configuration. This step sets up STUNner to act as a TURN server and exposes it on a public IP. ```bash git clone https://github.com/l7mp/stunner cd stunner/docs/examples/neko kubectl apply -f stunner.yaml ``` -------------------------------- ### Apply Kubernetes Configurations for STUNner Performance Source: https://docs.l7mp.io/en/stable/examples/benchmark Applies the necessary Kubernetes configurations for running STUNner and iperf server for performance benchmarking. Ensure you have a running STUNner installation and kubectl configured. ```bash kubectl apply -f iperf-server.yaml kubectl apply -f performance-stunner.yaml ``` -------------------------------- ### Install specific stunnerctl version and architecture Source: https://docs.l7mp.io/en/stable/cmd/stunnerctl Allows enforcing a specific operating system (OS), CPU architecture, and STUNner version during installation. This is useful for ensuring compatibility or testing specific versions. ```go GOOS=windows GOARCH=amd64 go install github.com/l7mp/stunner/cmd/stunnerctl@v0.17.5 ``` -------------------------------- ### Install icetester using Go Source: https://docs.l7mp.io/en/stable/cmd/icetester Installs the icetester utility using the Go toolchain. This command fetches the latest version from GitHub and makes the executable available in the system's PATH. ```bash go install github.com/l7mp/stunner/cmd/icetester@latest ``` -------------------------------- ### Run Local STUNner Performance Benchmark Source: https://docs.l7mp.io/en/stable/examples/benchmark Runs a local STUNner performance benchmark. This command configures and starts stunnerd, turncat clients, and an iperf server/client to measure performance without Kubernetes. ```bash ./benchmark.sh -n 5 -t 5 -s 1000 -b 100000000 -p local ``` -------------------------------- ### Install Stable STUNner Version using Helm Source: https://docs.l7mp.io/en/stable/INSTALL Installs the stable version of STUNner, including the control plane (gateway operator and authentication service). The dataplane is automatically provisioned. Recommended for production use. ```bash helm install stunner stunner/stunner --create-namespace --namespace=stunner-system ``` -------------------------------- ### Install specific turncat version for OS/Arch Source: https://docs.l7mp.io/en/stable/cmd/turncat Installs a specific version of the turncat binary for a designated OS and CPU architecture using Go environment variables. ```go GOOS=windows GOARCH=amd64 go install github.com/l7mp/stunner/cmd/turncat@v0.17.5 ``` -------------------------------- ### Install Nginx Ingress Controller using Helm Source: https://docs.l7mp.io/en/stable/examples/TLS Installs the official Nginx Ingress controller into a Kubernetes cluster using Helm. This is a prerequisite for securing traffic and terminating TLS connections. ```bash helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx helm repo update helm install ingress-nginx ingress-nginx/ingress-nginx ``` -------------------------------- ### Install turncat using curl script Source: https://docs.l7mp.io/en/stable/cmd/turncat Installs the latest turncat binary on Linux and macOS using a provided curl script. It also installs stunnerctl and adds the binary to the user's PATH. ```bash curl -sL https://raw.githubusercontent.com/l7mp/stunner/main/cmd/getstunner/getstunner.sh | sh - export PATH=$HOME/.l7mp/bin:$PATH ``` -------------------------------- ### Clone and Deploy STUNner Source: https://docs.l7mp.io/en/stable/examples/mediasoup Clones the STUNner git repository and applies the example Kubernetes manifest for integrating with mediasoup. This sets up STUNner to act as a STUN/TURN server. ```bash git clone https://github.com/l7mp/stunner cd stunner kubectl apply -f docs/examples/mediasoup/mediasoup-call-stunner.yaml ``` -------------------------------- ### Example ICE Configuration with Ephemeral Credentials Source: https://docs.l7mp.io/en/stable/examples/kurento-one2one-call This JSON object represents an example ICE server configuration for a client. It shows the structure of `iceServers` including `urls`, `username`, and `credential`, which are dynamically generated for ephemeral authentication in STUNner. ```json { "iceServers": [ { "urls": ["turn:34.118.112.176:3478?transport=udp"], "username": "1704390545:user", "credential": "br34ws29f1XAQqvMOthRHu0IglM=" } ], "iceTransportPolicy": "relay" } ``` -------------------------------- ### Install Prometheus and Grafana Stack using Helm Source: https://docs.l7mp.io/en/stable/MONITORING This command installs a pre-configured Prometheus and Grafana stack from the STUNner Helm repository. This stack includes Prometheus for metrics scraping, Grafana for visualization, and configures Prometheus as a data source for Grafana. It's recommended to run this in a dedicated 'monitoring' namespace. ```bash helm repo add stunner https://l7mp.io/stunner helm repo update helm install prometheus stunner/stunner-prometheus ``` -------------------------------- ### Clone STUNner Repository Source: https://docs.l7mp.io/en/stable/examples/cloudretro Clones the STUNner git repository to access example configurations and scripts. This is a prerequisite for setting up the CloudRetro demo. ```bash git clone https://github.com/l7mp/stunner cd stunner/docs/examples/cloudretro ``` -------------------------------- ### Describe Certificate Resources Source: https://docs.l7mp.io/en/stable/examples/TLS Provides detailed information about specific certificate, certificate request, or certificate signing request resources in Kubernetes. This is useful for troubleshooting certificate issuance problems. ```bash kubectl describe certificate -A kubectl describe certificaterequests.cert-manager.io -A kubectl describe certificatesigningrequests.certificates.k8s.io ``` -------------------------------- ### Execute STUNner Performance Benchmark Script Source: https://docs.l7mp.io/en/stable/examples/benchmark Executes the STUNner performance benchmark helper script with specified parameters. This script automates the process of setting up and running performance tests. ```bash ./benchmark.sh -n 5 -t 5 -s 1000 -b 100000 -p k8s ``` -------------------------------- ### Manually Install Kubernetes Gateway API CRDs Source: https://docs.l7mp.io/en/stable/INSTALL Applies the standard installation manifest for the Kubernetes Gateway API CRDs. This is a prerequisite for STUNner if CRDs are not installed by the Helm chart. ```bash kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.0.0/standard-install.yaml ``` -------------------------------- ### Run iperf UDP benchmark client Source: https://docs.l7mp.io/en/stable/examples/simple-tunnel This command initiates an iperf UDP benchmark test from the client to the server listening on localhost:5000. It specifies parameters for bandwidth, packet size, and duration. ```bash iperf -c localhost -p 5000 -u -i 1 -l 100 -b 800000 -t 10 ``` -------------------------------- ### Install STUNner Helm Chart Skipping CRDs Source: https://docs.l7mp.io/en/stable/INSTALL Installs the STUNner Helm chart without installing the Gateway API CRDs and STUNner CRDs. Assumes CRDs are already present in the cluster. Useful for managed Kubernetes environments. ```bash helm install stunner stunner/stunner --create-namespace --namespace=stunner-system --skip-crds ``` -------------------------------- ### Manually Install STUNner CRDs Source: https://docs.l7mp.io/en/stable/INSTALL Applies the STUNner Custom Resource Definition (CRD) manifest. This is required for the STUNner Gateway Operator to function correctly if CRDs are not installed by the Helm chart. ```bash kubectl apply -f https://raw.githubusercontent.com/l7mp/stunner-helm/refs/heads/main/helm/stunner-gateway-operator/crds/stunner-crd.yaml ``` -------------------------------- ### Add and Update Helm Repository for STUNner Source: https://docs.l7mp.io/en/stable/INSTALL Registers the STUNner Helm repository and updates the local Helm chart repository. This is the first step before installing STUNner using Helm. ```bash helm repo add stunner https://l7mp.io/stunner helm repo update ``` -------------------------------- ### Deploy Mediasoup Server (Kubernetes Bash) Source: https://docs.l7mp.io/en/stable/examples/mediasoup Creates the 'mediasoup' namespace and applies the mediasoup server configuration to the Kubernetes cluster. This deploys the mediasoup server, application server, cluster issuer, and Ingress resource. ```bash kubectl create ns mediasoup kubectl apply -f docs/examples/mediasoup/mediasoup-server.yaml ``` -------------------------------- ### Install Cert-Manager using Helm Source: https://docs.l7mp.io/en/stable/examples/TLS Installs cert-manager, a Kubernetes add-on for automating TLS certificate management, using its official Helm chart. It ensures CRDs are enabled and sets the namespace for leader election. ```bash helm repo add jetstack https://charts.jetstack.io helm repo update helm install cert-manager jetstack/cert-manager --namespace cert-manager \ --create-namespace --set global.leaderElection.namespace=cert-manager \ --set crds.enabled=true --timeout 600s ``` -------------------------------- ### Restart STUNner Gateway Deployment after Dev Channel Upgrade Source: https://docs.l7mp.io/en/stable/INSTALL Manually restarts the dataplane for STUNner Gateways after upgrading from the development channel. This ensures the new version is applied correctly. ```bash kubectl -n rollout restart deployment ``` -------------------------------- ### Run iperf UDP benchmark client and view last log line Source: https://docs.l7mp.io/en/stable/examples/simple-tunnel This command runs an iperf UDP benchmark with higher packet rate and redirects verbose output to /dev/null, then displays only the last line of the iperf server logs for concise results analysis. ```bash iperf -c localhost -p 5000 -u -l 100 -b 8000000 -o /dev/null -t 10 && \ kubectl logs $(kubectl get pods -l app=iperf-server -o jsonpath='{.items[0].metadata.name}') | tail -n 1 ``` -------------------------------- ### Dump TCP Gateway Configuration with stunnerctl Source: https://docs.l7mp.io/en/stable/examples/simple-tunnel This command uses the `stunnerctl` utility to display the current configuration of the TCP gateway. Ensure `stunnerctl` is built by running `make build` in the project's root directory. The output details the gateway's settings, authentication, listeners, and associated routes. ```bash bin/stunnerctl -n stunner config tcp-gateway ``` -------------------------------- ### Apply iperf Server Deployment and Service (Kubernetes) Source: https://docs.l7mp.io/en/stable/examples/simple-tunnel This command applies a Kubernetes manifest to deploy an iperf server and expose it as a ClusterIP service named `iperf-server`. This ensures the server is only accessible within the cluster, making STUNner the sole external access point. ```bash cd stunner kubectl apply -f docs/examples/simple-tunnel/iperf-server.yaml ``` -------------------------------- ### Restart STUNner Operator Source: https://docs.l7mp.io/en/stable/PREMIUM_INSTALL Restarts the STUNner gateway operator deployment in the `stunner-system` namespace. This action is necessary after updating the customer key to ensure the operator reads the new key and unlocks premium features. ```bash kubectl -n stunner-system rollout restart deployment stunner-gateway-operator-controller-manager ``` -------------------------------- ### Deploy UDP Greeter Service with kubectl Source: https://docs.l7mp.io/en/stable/examples/udp-echo This command deploys a UDP greeter service and wraps it in a Kubernetes service named `media-plane`. This service is of type `ClusterIP`, making it inaccessible directly from outside the cluster, thus requiring STUNner for external access. ```bash kubectl apply -f https://raw.githubusercontent.com/l7mp/stunner/refs/heads/main/docs/examples/udp-echo/udp-greeter.yaml ``` -------------------------------- ### Edit STUNner Customer Secret Source: https://docs.l7mp.io/en/stable/PREMIUM_INSTALL Opens the Kubernetes secret `stunner-gateway-operator-customer-secret` in the `nano` editor for manual modification. This allows updating the `data.CUSTOMER_KEY` or preferably `stringData.CUSTOMER_KEY` with the valid customer key. Ensure to save the changes. ```bash EDITOR=nano kubectl -n stunner-system edit secret stunner-gateway-operator-customer-secret ``` -------------------------------- ### Enable UDP Multithreading via Helm Chart Source: https://docs.l7mp.io/en/stable/INSTALL This Helm chart flag enables UDP multithreading for STUNner deployments. It allows the system to leverage `SO_REUSEPORT` for distributing UDP traffic across multiple readloops, improving scalability. ```bash --set stunner.deployment.container.stunnerd.udpMultithreading.enabled=true ``` -------------------------------- ### Test UDP Greeter Service with turncat Source: https://docs.l7mp.io/en/stable/examples/udp-echo This command initiates a connection to the STUNner UDP gateway using the `turncat` client. It sends 'Hello STUNner' and expects a 'Greetings from STUNner!' response, demonstrating successful routing and service interaction. ```bash ./turncat - k8s://stunner/udp-gateway:udp-listener udp://${PEER_IP}:9001 Hello STUNner ``` -------------------------------- ### Build stunnerctl from source Source: https://docs.l7mp.io/en/stable/cmd/stunnerctl Builds the `stunnerctl` binary directly from the source code using the Go build command. This method is suitable for developers or when the latest unreleased changes are needed. ```go cd stunner go build -o stunnerctl cmd/stunnerctl/main.go ``` -------------------------------- ### Patch STUNner Customer Secret Source: https://docs.l7mp.io/en/stable/PREMIUM_INSTALL Patches the Kubernetes secret `stunner-gateway-operator-customer-secret` to add or replace the `CUSTOMER_KEY` within the `stringData` field. This is an alternative to manual editing for updating the customer key. Replace `` with the actual key. ```bash kubectl -n stunner-system patch secret stunner-gateway-operator-customer-secret --type='json' \ -p='[{"op": "add" ,"path": "/stringData" ,"value": {}}, {"op": "replace" ,"path": "/stringData/CUSTOMER_KEY" ,"value": ""}]' ``` -------------------------------- ### Configure Termination Grace Period in Helm Chart Source: https://docs.l7mp.io/en/stable/INSTALL This Helm chart flag allows customization of the `terminationGracePeriodSeconds` for STUNner pods. It controls how long pods remain active to ensure all active allocations are deleted or timed out, facilitating graceful scale-down. ```bash --set stunner.deployment.container.terminationGracePeriodSeconds= ``` -------------------------------- ### Configure TURN Server via URL Parameters in Mediasoup Source: https://docs.l7mp.io/en/stable/examples/mediasoup This example shows how to parse URL parameters to configure a TURN server for mediasoup clients. The mediasoup clients will use these parameters to gather ICE candidates, enabling them to connect through the specified TURN server for NAT traversal. This allows for flexible configuration of TURN server details. ```javascript https://mediasoup-demo.example.com/?enableIceServer=yes&iceServerHost=100.100.100.100&iceServerPort=3478&iceServerProto=udp&iceServerUser=user-1&iceServerPass=pass-1 ``` -------------------------------- ### Create STUNner Customer Secret Source: https://docs.l7mp.io/en/stable/PREMIUM_INSTALL Creates a Kubernetes generic secret named `stunner-gateway-operator-customer-secret` in the `stunner-system` namespace. This secret is used by STUNner to store the customer key required for premium features. Replace `` with the actual key. ```bash kubectl -n stunner-system create secret generic stunner-gateway-operator-customer-secret --from-literal=CUSTOMER_KEY="" ``` -------------------------------- ### Enable UDP Multithreading via stunnerd CLI Source: https://docs.l7mp.io/en/stable/INSTALL This command-line flag enables UDP multithreading in the `stunnerd` process, allowing it to create multiple UDP server sockets and goroutines for parallel readloops to enhance load balancing and performance on UNIX-like systems. ```bash stunnerd --udp-thread-num= ``` -------------------------------- ### Configure UDP Multithreading in STUNner Source: https://docs.l7mp.io/en/stable/INSTALL This configuration snippet shows how to enable and set the number of read loops per UDP listener for STUNner's UDP multithreading feature. This is typically used in Helm charts to control load balancing for UDP traffic. ```yaml udpMultithreading: enabled: true readLoopsPerUDPListener: 16 ``` -------------------------------- ### View iperf server logs Source: https://docs.l7mp.io/en/stable/examples/simple-tunnel This command retrieves the logs from the iperf-server pod in Kubernetes, allowing you to view the benchmark results transmitted via turncat and STUNner. ```bash kubectl logs $(kubectl get pods -l app=iperf-server -o jsonpath='{.items[0].metadata.name}') ``` -------------------------------- ### Build and Push Docker Image Source: https://docs.l7mp.io/en/stable/examples/elixir-webrtc This snippet demonstrates how to build a Docker image for Nexus and push it to a specified repository. It requires setting the MYREPO environment variable to your Docker repository name. ```bash export MYREPO=myrepo # use your own Docker repository name! sudo docker build -t $MYREPO/nexus . sudo docker push $MYREPO/nexus ``` -------------------------------- ### Check STUNner License Status with stunnerctl Source: https://docs.l7mp.io/en/stable/PREMIUM_INSTALL This command-line tool connects to the STUNner gateway operator to retrieve and display the current license status, including subscription type, enabled features, and last updated timestamp. It also reports any errors encountered during license validation. ```bash stunnerctl license License status: Subscription type: member Enabled features: DaemonSet, STUNServer, ... Last updated: ... ``` -------------------------------- ### Check STUNner Dataplane Pod License Status Source: https://docs.l7mp.io/en/stable/PREMIUM_INSTALL This command retrieves the licensing status for individual STUNner dataplane pods. It connects to each pod of a specified gateway (e.g., `stunner/udp-gateway`) and outputs the license information in JSON format, detailing the subscription tier and unlocked premium features. ```bash stunnerctl -a status -o jsonpath='License status for dataplane node {.admin.Name}: {.admin.licensing_info}' {tier=enterprise,unlocked-features=[TURNOffload,UserQuota,DaemonSet,STUNServer,RelayAddressDiscovery],valid-until=...} ... ``` -------------------------------- ### Build turncat from source Source: https://docs.l7mp.io/en/stable/cmd/turncat Builds the turncat binary directly from the source code using the Go build command. This is useful for development or when a specific build is required. ```go cd stunner go build -o turncat cmd/turncat/main.go ``` -------------------------------- ### Debug STUNner License Issues via Kubernetes Logs Source: https://docs.l7mp.io/en/stable/PREMIUM_INSTALL This command retrieves logs from the STUNner gateway operator pod, which can help in debugging license-related problems. It targets the specific pod running the controller manager and filters for log messages from the `license-mgr` component, providing insights into license status and connection details. ```bash kubectl -n stunner-system logs $(kubectl -n stunner-system get pods -l \ control-plane=stunner-gateway-operator-controller-manager -o jsonpath='{.items[0].metadata.name}') ...license-mgr license manager client created {"server": "https://license.l7mp.io:443", "customer-key-status": "set"} ... ...license-mgr new license status {"subscription-type": "enterprise", "enabled-features": ["DaemonSet", "UserQuota", "STUNServer", "TURNOffload"], "last-updated": "..."} ... ``` -------------------------------- ### Apply CloudRetro Kubernetes Resources Source: https://docs.l7mp.io/en/stable/examples/cloudretro Applies the Kubernetes YAML configurations to set up the CloudRetro Coordinator and Workers. These are essential components for the cloud-gaming service. ```bash kubectl apply -f cloudretro-setup-coordinator.yaml kubectl apply -f cloudretro-setup-workers.yaml ``` -------------------------------- ### Scale Kurento Media Server Deployment Source: https://docs.l7mp.io/en/stable/examples/kurento-magic-mirror This command scales the Kurento media server deployment ('kms') to 4 replicas. This demonstrates how STUNner and Kubernetes can be used to effortlessly scale the media server pool, leveraging automatic health-checks and load-balancing. ```bash kubectl scale deployment kms --replicas=4 ``` -------------------------------- ### Dump STUNner Gateway Configuration with stunnerctl Source: https://docs.l7mp.io/en/stable/examples/direct-one2one-call This command uses the `stunnerctl` CLI tool to display the human-readable configuration of a specific STUNner gateway, in this case, 'udp-gateway'. Ensure `stunnerctl` is built by running `make build` in the project's root directory. ```bash bin/stunnerctl -n stunner config udp-gateway ```