# Beszel Agent Helm ChartA Kubernetes Helm chart for deploying [Beszel Agent](https://www.beszel.dev/) - a lightweight monitoring agent that collects system metrics and sends them to a central Beszel Hub.## OverviewThis Helm chart simplifies the deployment of Beszel Agent in Kubernetes environments. By default, it deploys as a DaemonSet to run one agent on each node in the cluster. The agent monitors node-level system resources (CPU, memory, disk, network, temperature, GPU, etc.) and provides detailed metrics to the Beszel Hub for centralized monitoring and alerting.## Features- ✅ DaemonSet deployment by default (one agent per node)- ✅ GPU support via NVIDIA runtime (optional)- ✅ Additional filesystem mounting for multi-disk monitoring- ✅ Flexible deployment as DaemonSet or single Deployment- ✅ Environment variable configuration for agent authentication- ✅ Host network support for detailed network monitoring- ✅ Automatic handling of tainted nodes via tolerations## Prerequisites- Kubernetes 1.19+- Helm 3.0+- Beszel Hub instance running and accessible- SSH public key for agent authentication## What Gets MonitoredIn Kubernetes environments, the Beszel agent monitors **node-level metrics**:- **CPU usage** - Node CPU utilization and per-core stats- **Memory usage** - Node memory, swap, and ZFS ARC- **Disk usage** - Node filesystem usage and I/O statistics- **Network usage** - Node network traffic (requires `hostNetwork: true`)- **Load average** - System load averages- **Temperature** - Node hardware sensors- **GPU usage/power** - NVIDIA, AMD, and Intel GPUs (with appropriate image)- **Battery** - Node battery status (if applicable)- **S.M.A.T.** - Disk health monitoring**Note**: The agent does **not** monitor individual Kubernetes pods or containers. For pod/container metrics, use Kubernetes metrics-server or monitoring tools like Prometheus.## Quick Start### 1. Install the OCI Chart```bashhelm install beszel-agent oci://ghcr.io/henrygd/beszel-charts/beszel-agent \--set env.KEY="ssh-ed25519 AAAA... your-public-key" \--set env.TOKEN="your-token-value" \--set env.HUB_URL="http://beszel-hub:8090"```Or with custom values:```bashhelm install beszel-agent oci://ghcr.io/henrygd/beszel-charts/beszel-agent -f custom-values.yaml```### 2. Verify the Agent is Running```bashkubectl get pods -l app.kubernetes.io/name=beszel-agentkubectl logs -l app.kubernetes.io/name=beszel-agent```## Configuration### Basic ConfigurationEssential parameters to configure:| Parameter | Default | Description ||-----------|---------|-------------|| `daemonset.enabled` | `true` | Deploy as DaemonSet (one pod per node) || `env.KEY` | Required* | SSH public key for Hub authentication (*unless using existingSecret) || `env.TOKEN` | Empty | Authentication token (optional) || `env.HUB_URL` | Empty | Hub URL (e.g., http://beszel-hub:8090) || `env.PORT` | `45876` | Port the agent listens on || `secret.existingSecret` | Empty | Name of an existing Kubernetes Secret to use || `secret.sshKey` | `ssh-key` | Key name in the secret for the SSH public key || `secret.tokenKey` | `token` | Key name in the secret for the authentication token || `image.repository` | `henrygd/beszel-agent` | Container image || `image.tag` | Chart AppVersion (0.21.2) | Image version || `hostNetwork` | `false` | Use host network for network monitoring || `tolerations` | Allows all taints | Tolerations for running on tainted nodes |### Minimal Configuration```bashhelm install beszel-agent ./beszel-agent \--set env.KEY="ssh-ed25519 AAAA... your-public-key" \--set env.TOKEN="your-token-value" \--set env.HUB_URL="http://beszel-hub:8090"```### Standard Configuration```yaml# values.yamlimage:repository: henrygd/beszel-agenttag: "" # Uses chart appVersionenv:PORT: "45876"KEY: "ssh-ed25519 AAAA... your-public-key"TOKEN: "your-token-value"HUB_URL: "http://beszel-hub:8090"# Use host network for accurate network monitoringhostNetwork: false```### GPU Support (NVIDIA)For systems with NVIDIA GPUs, use the special GPU-enabled image:```yamlimage:repository: henrygd/beszel-agent-nvidia# Enable NVIDIA runtimegpuRuntime: nvidiaenv:PORT: "45876"KEY: "ssh-ed25519 AAAA... your-public-key"TOKEN: "your-token-value"HUB_URL: "http://beszel-hub:8090"NVIDIA_VISIBLE_DEVICES: "all"NVIDIA_DRIVER_CAPABILITIES: "compute,video,utility"```**Note**: The GPU image (`henrygd/beszel-agent-nvidia`) is specifically for monitoring NVIDIA GPUs on the node. It does not provide container-level GPU metrics.Or via CLI:```bashhelm install beszel-agent ./beszel-agent \--set image.repository=henrygd/beszel-agent-nvidia \--set gpuRuntime=nvidia \--set env.NVIDIA_VISIBLE_DEVICES=all \--set env.NVIDIA_DRIVER_CAPABILITIES="compute,video,utility" \--set env.KEY="ssh-ed25519 AAAA... your-public-key" \--set env.TOKEN="your-token-value" \--set env.HUB_URL="http://beszel-hub:8090"```### Monitor Additional FilesystemsTo monitor additional disks or partitions:```yamlvolumes:- name: extra-filesystemshostPath:path: /mnt/disk/.beszeltype: DirectoryOrCreatevolumeMounts:- name: extra-filesystemsmountPath: /extra-filesystemsreadOnly: trueenv:PORT: "45876"KEY: "ssh-ed25519 AAAA... your-public-key"TOKEN: "your-token-value"HUB_URL: "http://beszel-hub:8090"```### Advanced Configuration#### Resource Limits```yamlresources:limits:cpu: 500mmemory: 256Mirequests:cpu: 100mmemory: 128Mi```#### Node SelectionRun agents on specific nodes:```yamlnodeSelector:monitoring: "true"tolerations:- key: monitoringoperator: Equalvalue: "true"effect: NoScheduleaffinity:podAntiAffinity:preferredDuringSchedulingIgnoredDuringExecution:- weight: 100podAffinityTerm:labelSelector:matchExpressions:- key: app.kubernetes.io/nameoperator: Invalues:- beszel-agenttopologyKey: kubernetes.io/hostname```#### Host NetworkFor detailed network statistics, enable host network mode:```yamlhostNetwork: trueenv:PORT: "45876"KEY: "ssh-ed25519 AAAA... your-public-key"TOKEN: "your-token-value"HUB_URL: "http://beszel-hub:8090"```**Note**: When `hostNetwork: true`, the agent can monitor the node's actual network interfaces. When `false`, it only sees the pod's network namespace.#### DaemonSet ModeBy default, the agent is deployed as a DaemonSet, running one pod on each cluster node:```yamldaemonset:enabled: true # Default - one agent per node# Or disable for single Deployment deploymentdaemonset:enabled: falsereplicaCount: 1```#### TolerationsBy default, tolerations are set to allow agents to run on all nodes, including tainted ones:```yamltolerations:- operator: Existseffect: NoSchedule- operator: Existseffect: NoExecute```To restrict agents to specific nodes:```yamltolerations: []nodeSelector:monitoring: "true"```### Using Existing SecretsThe chart supports referencing an existing Kubernetes Secret instead of having the chart create one. This is useful when:- You want to manage secrets externally (e.g., with a secret operator, external secret manager, or GitOps)- You want to share a single secret across multiple deployments- You prefer not to store sensitive values in Helm values```yaml# Create the secret manuallyapiVersion: v1kind: Secretmetadata:name: my-beszel-secrettype: Opaquedata:ssh-key: c3NoLWVkMjU1IDEgQUFBQU... # base64 encoded SSH public keytoken: dG9rZW4tdmFsdWU= # base64 encoded token (optional)```Then reference it in your values:```yamlsecret:existingSecret: my-beszel-secretsshKey: ssh-key # key name in the secret (default: ssh-key)tokenKey: token # key name in the secret (default: token)env:HUB_URL: "http://beszel-hub:8090"```**Note**: When using `existingSecret`, do not set `env.KEY` or `env.TOKEN` - the chart will use the values from the existing secret instead.You can also use different key names if your secret uses non-standard keys:```yamlsecret:existingSecret: my-beszel-secretsshKey: public-key # custom key nametokenKey: auth-token # custom key name```## Deployment Examples### Full Cluster Monitoring (DaemonSet - Default)```bashhelm install beszel-agent ./beszel-agent \--set env.KEY="ssh-ed25519 AAAA... your-public-key" \--set env.TOKEN="your-token-value" \--set env.HUB_URL="http://beszel-hub:8090"```This deploys one agent on every node in the cluster automatically.### Single Agent Deployment (Non-DaemonSet)```yaml# values.yamldaemonset:enabled: falsereplicaCount: 1env:PORT: "45876"KEY: "ssh-ed25519 AAAA... your-public-key"TOKEN: "your-token-value"HUB_URL: "http://beszel-hub:8090"```Or via CLI:```bashhelm install beszel-agent ./beszel-agent \--set daemonset.enabled=false \--set replicaCount=1 \--set env.KEY="ssh-ed25519 AAAA... your-public-key" \--set env.TOKEN="your-token-value" \--set env.HUB_URL="http://beszel-hub:8090"```### Network Monitoring with Host Network```yamlhostNetwork: trueenv:PORT: "45876"KEY: "ssh-ed25519 AAAA... your-public-key"TOKEN: "your-token-value"HUB_URL: "http://beszel-hub:8090"podSecurityContext:hostNetwork: true```## Managing the Agent### Check Agent Status```bash# List agent podskubectl get pods -l app.kubernetes.io/name=beszel-agent# View agent logskubectl logs -l app.kubernetes.io/name=beszel-agent -f# Describe a specific podkubectl describe pod <pod-name>```### Update Configuration```bash# Update the SSH keyhelm upgrade beszel-agent ./beszel-agent \--set env.KEY="ssh-ed25519 AAAA... your-public-key" \--set env.TOKEN="your-token-value" \--set env.HUB_URL="http://beszel-hub:8090"# Change image versionhelm upgrade beszel-agent ./beszel-agent \--set image.tag="0.21.2"```### Restart All Agents```bash# For DaemonSet (default)kubectl rollout restart daemonset beszel-agent# For Deployment (if daemonset.enabled=false)kubectl rollout restart deployment beszel-agent```### Uninstall```bashhelm uninstall beszel-agent```### View Helm Release History```bashhelm history beszel-agenthelm rollback beszel-agent 1 # Rollback to previous version```## Environment Variables| Variable | Default | Description ||----------|---------|-------------|| `PORT` | `45876` | Port the agent listens on || `KEY` | Required | SSH public key for Hub authentication || `TOKEN` | Empty | Authentication token (optional) || `HUB_URL` | Empty | Hub URL (e.g., http://beszel-hub:8090) || `NVIDIA_VISIBLE_DEVICES` | Not set | GPU visibility (GPU agents only) || `NVIDIA_DRIVER_CAPABILITIES` | Not set | GPU capabilities (GPU agents only) |## Troubleshooting### Agent Pod Won't Start```bash# Check pod events and logskubectl describe pod <pod-name>kubectl logs <pod-name>```### Cannot Connect to Hub- Verify Hub is accessible from the pod's network- Check DNS resolution: `kubectl exec <pod-name> -- nslookup beszel-hub.default.svc.cluster.local`- Verify SSH key is correctly configured- Check firewall rules for port 8090 (Hub) and 45876 (Agent)### GPU Not Detected- Confirm image is `henrygd/beszel-agent-nvidia`- Verify NVIDIA runtime is installed on nodes- Check GPU visibility: `kubectl exec <pod-name> -- nvidia-smi`- Verify runtimeClassName matches your GPU runtime### SSH Key Authentication Failed- Verify key format (should be valid SSH public key)- Check key is correctly set in `env.KEY`- Ensure Hub has the corresponding private key- Verify Hub can authenticate agents with this key### High Memory UsageAdjust resource limits:```yamlresources:limits:memory: 512Mirequests:memory: 256Mi```## Security Considerations- Store SSH keys securely (use Kubernetes Secrets)- Restrict container to read-only root filesystem if possible- Limit resource usage with resource limits- Use network policies to restrict traffic- Run with minimal privileges- Regularly update agent image to latest version- Use private container registries if applicable### Using Kubernetes Secrets for ConfigurationThe chart automatically creates a Kubernetes Secret to store sensitive authentication data:```bash# Install with all configuration optionshelm install beszel-agent ./beszel-agent \--set env.KEY="ssh-ed25519 AAAA... your-public-key" \--set env.TOKEN="your-optional-token" \--set env.HUB_URL="http://beszel-hub:8090"```Or create the installation with a values file:```yaml# values.yamlenv:KEY: "ssh-ed25519 AAAA... your-public-key"TOKEN: "your-optional-token"HUB_URL: "http://beszel-hub:8090"```Configuration stored in Kubernetes Secrets (encrypted at rest):- `KEY` - SSH public key for authentication (required)- `TOKEN` - Authentication token (optional)Configuration as regular environment variables:- `HUB_URL` - Hub address (e.g., http://beszel-hub:8090 or https://beszel.example.com)To verify the secret was created:```bashkubectl get secret beszel-agentkubectl get secret beszel-agent -o jsonpath='{.data.ssh-key}' | base64 -d```## Support and Documentation- **Project Homepage**: https://www.beszel.dev/- **GitHub Repository**: https://github.com/henrygd/beszel- **Agent Documentation**: https://www.beszel.dev/**Note**: The main Beszel documentation describes Docker/Podman container monitoring. In Kubernetes, the agent focuses on node-level metrics. For Kubernetes-specific container/pod monitoring, use tools like metrics-server, Prometheus, or the Kubernetes Metrics API.## Chart Information- **Chart Version**: 0.1.0- **App Version**: 0.21.2- **Kubernetes Version**: 1.19+- **Maintainer**: cloudwithdan (nikoloskid@pm.me)## LicensePlease refer to the main Beszel project repository for license information.