Domain
or ClusterDomain
2 minute read
Configuring DNS settings can be a daunting task, but with Custom DNS mode, you can leverage Go templates to streamline the process. This guide will walk you through the essentials of setting up Custom DNS for your Domain or ClusterDomain resources.
Custom DNS mode allows users to utilize Go templates to generate DNS entries dynamically. This is particularly useful for managing complex DNS configurations with ease. The dnsTemplates
field is where you specify your desired setup.
You can enhance your templates with functions from the Slim Sprig library, detailed here.
spec.domain
.spec.dnsTarget
or derived from spec.istioIngressSelector
.Below is an example of how to configure Custom DNSMode for a Domain
resource:
apiVersion: sme.sap.com/v1alpha1
kind: Domain
metadata:
namespace: cap-app-01
name: cap-app-01-primary
spec:
domain: my.cluster.shoot.url.k8s.example.com
ingressSelector:
app: istio-ingressgateway
istio: ingressgateway
dnsMode: Custom
dnsTemplates:
- name: '*.{{ .domain }}'
target: '{{ .dnsTarget }}'
- name: '{{ .subDomain }}.{{ .domain }}'
target: '{{ .dnsTarget }}'
- name: '{{ .subDomain }}.myapp.com'
target: '{{ .subDomain }}.{{ .domain }}'
This configuration can be applied to both Domain
and ClusterDomain
resources, offering flexibility and control over your DNS configurations.