You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds configuration to customize resolv.conf file paths
for pod and node DNS resolution in network disruptions.
Users can now override default paths via Helm values,
ConfigMap, or CLI flags to support different Kubernetes
distributions (systemd-resolved, NetworkManager, etc.).
Configuration:
- injector.networkDisruption.dnsPodResolvConf
- injector.networkDisruption.dnsNodeResolvConf
Defaults: /etc/resolv.conf (pod),
/mnt/host/etc/resolv.conf (node)
Logs show which resolv.conf files are loaded with their
nameservers for debugging.
Jira: CHAOSPLT-1360
mainFS.StringVar(&cfg.Injector.NetworkDisruption.DNSPodResolvConf, "injector-network-disruption-dns-pod-resolv-conf", "/etc/resolv.conf", "Path to pod DNS resolv.conf file")
mainFS.StringVar(&cfg.Injector.NetworkDisruption.DNSNodeResolvConf, "injector-network-disruption-dns-node-resolv-conf", "/mnt/host/etc/resolv.conf", "Path to node DNS resolv.conf file")
- **`pod-fallback-node`** (default): Use when you want resilience - try pod DNS first but fall back to node DNS if it fails
323
325
- **`node-fallback-pod`**: Use when node DNS is preferred but you want pod DNS as a backup
324
326
327
+
#### Customizing resolv.conf Paths
328
+
329
+
By default, the chaos-controller uses these locations for resolv.conf files:
330
+
331
+
- **Pod DNS**: `/etc/resolv.conf`
332
+
- **Node DNS**: `/mnt/host/etc/resolv.conf`
333
+
334
+
These defaults are set in the controller configuration. Some Kubernetes distributions or node configurations may use different locations for resolv.conf. You can override the defaults using Helm values:
3. The injector uses these paths for DNS resolution
385
+
4. Logs will show which resolv.conf files were loaded:
386
+
```
387
+
INFO loaded pod DNS configuration resolv_conf_path=/run/systemd/resolve/resolv.conf nameservers=[8.8.8.8, 8.8.4.4]
388
+
INFO loaded node DNS configuration resolv_conf_path=/mnt/host/run/systemd/resolve/stub-resolv.conf nameservers=[10.0.0.1]
389
+
```
390
+
391
+
You can verify the paths used by an injector pod:
392
+
```bash
393
+
kubectl describe pod chaos-injector-xxxxx -n chaos-engineering | grep dns-
394
+
```
395
+
396
+
**Use cases:**
397
+
- **systemd-resolved**: Nodes using systemd-resolved may have resolv.conf at `/run/systemd/resolve/resolv.conf` or `/run/systemd/resolve/stub-resolv.conf`
398
+
- **NetworkManager**: Some distributions use `/run/NetworkManager/resolv.conf`
399
+
- **Custom Kubernetes distributions**: Distributions like k3s, microk8s, or OpenShift may use non-standard paths
400
+
- **Custom DNS configurations**: Environments with custom DNS setups that require specific resolv.conf locations
401
+
325
402
### Some special cases
326
403
327
404
Cluster IPs can also be specified to target the relevant pods.
0 commit comments