diff --git a/EXAMPLES.md b/EXAMPLES.md index da2b59f02..6ac5afbe0 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -7,6 +7,39 @@ deployment: kind: DaemonSet ``` +# Configure traefik Pod parameters + +## Extending /etc/hosts records + +In some specific cases, you'll need to add extra records to the `/etc/hosts` file for the Traefik containers. +You can configure it using [hostAliases](https://kubernetes.io/docs/tasks/network/customize-hosts-file-for-pods/): + +```yaml +deployment: + hostAliases: + - ip: "127.0.0.1" # this is an example + hostnames: + - "foo.local" + - "bar.local" +``` +## Extending DNS config + +In order to configure additional DNS servers for your traefik pod, you can use `dnsConfig` option: + +```yaml +deployment: + dnsConfig: + nameservers: + - 192.0.2.1 # this is an example + searches: + - ns1.svc.cluster-domain.example + - my.dns.search.suffix + options: + - name: ndots + value: "2" + - name: edns0 +``` + # Install in a dedicated namespace, with limited RBAC Default install is using Cluster-wide RBAC but it can be restricted to target namespace. diff --git a/traefik/VALUES.md b/traefik/VALUES.md index 390d0c5ae..1e5ac3c09 100644 --- a/traefik/VALUES.md +++ b/traefik/VALUES.md @@ -40,6 +40,7 @@ Kubernetes: `>=1.22.0-0` | deployment.annotations | object | `{}` | Additional deployment annotations (e.g. for jaeger-operator sidecar injection) | | deployment.dnsConfig | object | `{}` | Custom pod DNS policy. Apply if `hostNetwork: true` dnsPolicy: ClusterFirstWithHostNet | | deployment.enabled | bool | `true` | Enable deployment | +| deployment.hostAliases | list | `[]` | Custom [host aliases](https://kubernetes.io/docs/tasks/network/customize-hosts-file-for-pods/) | | deployment.imagePullSecrets | list | `[]` | Additional imagePullSecrets | | deployment.initContainers | list | `[]` | Additional initContainers (e.g. for setting file permission as shown below) | | deployment.kind | string | `"Deployment"` | Deployment or DaemonSet | diff --git a/traefik/templates/_podtemplate.tpl b/traefik/templates/_podtemplate.tpl index c7132c3f1..b370a5eb8 100644 --- a/traefik/templates/_podtemplate.tpl +++ b/traefik/templates/_podtemplate.tpl @@ -43,6 +43,9 @@ {{- toYaml .options | nindent 10 }} {{- end }} {{- end }} + {{- with .Values.deployment.hostAliases }} + hostAliases: {{- toYaml . | nindent 8 }} + {{- end }} {{- with .Values.deployment.initContainers }} initContainers: {{- toYaml . | nindent 6 }} diff --git a/traefik/values.yaml b/traefik/values.yaml index e440dcf62..616b89714 100644 --- a/traefik/values.yaml +++ b/traefik/values.yaml @@ -81,19 +81,12 @@ deployment: shareProcessNamespace: false # -- Custom pod DNS policy. Apply if `hostNetwork: true` # dnsPolicy: ClusterFirstWithHostNet + # -- Custom pod [DNS config](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#poddnsconfig-v1-core) dnsConfig: {} - # nameservers: - # - 192.0.2.1 # this is an example - # searches: - # - ns1.svc.cluster-domain.example - # - my.dns.search.suffix - # options: - # - name: ndots - # value: "2" - # - name: edns0 - # -- Additional imagePullSecrets + # -- Custom [host aliases](https://kubernetes.io/docs/tasks/network/customize-hosts-file-for-pods/) + hostAliases: [] + # -- Pull secret for fetching traefik container image imagePullSecrets: [] - # - name: myRegistryKeySecretName # -- Pod lifecycle actions lifecycle: {} # preStop: