helm/librechat/DNS_CONFIGURATION.md
This feature allows you to configure custom DNS settings for LibreChat pods, enabling traffic redirection to proxy servers or custom endpoints.
The dnsPolicy field determines how DNS resolution works:
ClusterFirst (default): Prefer cluster DNS, fallback to configured DNSDefault: Use the node's DNS settingsNone: Only use the DNS settings from dnsConfigClusterFirstWithHostNet: For pods using host networkThe dnsConfig field allows you to specify:
nameservers: List of DNS server IPs (max 3)searches: List of DNS search domains for hostname lookupoptions: List of DNS resolver options# values.yaml
dnsPolicy: "None"
dnsConfig:
nameservers:
- "10.0.0.10" # Custom DNS server
# values.yaml
dnsPolicy: "None"
dnsConfig:
nameservers:
- "10.96.0.100" # DNS server that redirects AI domains to proxy
searches:
- "svc.cluster.local"
options:
- name: ndots
value: "2"
Deploy:
helm upgrade --install librechat ./helm/librechat -f values.yaml
# values.yaml
dnsPolicy: "None"
dnsConfig:
nameservers:
- "192.168.1.53" # Primary corporate DNS
- "192.168.1.54" # Secondary corporate DNS
searches:
- "corp.internal"
- "svc.cluster.local"
helm install librechat ./helm/librechat \
--set dnsPolicy="None" \
--set dnsConfig.nameservers[0]="10.0.0.10"
kubectl exec <pod-name> -- cat /etc/resolv.conf
kubectl exec <pod-name> -- nslookup example.com
The feature has been tested with the following scenarios:
✅ DNS Resolution Test
✅ Multiple Nameservers
✅ Integration Test
For simple host-to-IP mappings, you can combine DNS configuration with hostAliases:
# In deployment spec (not directly in values.yaml)
spec:
dnsPolicy: "None"
dnsConfig:
nameservers:
- "10.0.0.10"
hostAliases:
- ip: "10.100.50.200"
hostnames:
- "api.openai.com"
You can use Helm's templating to dynamically set DNS based on environment:
{{- if eq .Values.environment "production" }}
dnsPolicy: "None"
dnsConfig:
nameservers:
- "10.0.0.10" # Production DNS
{{- else }}
dnsPolicy: "ClusterFirst" # Use default in dev
{{- end }}
kubectl get pod <pod-name> -o yaml | grep -A5 dnsPolicy
kubectl exec <pod-name> -- ping <nameserver-ip>
Ensure values are properly indented in values.yaml:
dnsPolicy: "None" # Top level, not under any section
dnsConfig: # Top level, not under any section
nameservers:
- "10.0.0.10"