Configure Local Domain
Configure Local Domain
By configuring the local domain, you can access functions from within a Kubernetes cluster through the function’s external address.
Configure CoreDNS
based on Gateway.spec.domain
Assume you have a Gateway
that defines this domain
: *.ofn.io
, you need to update CoreDNS
configuration via following commands:
- Edit the
coredns
configmap:
kubectl -n kube-system edit cm coredns -o yaml
- Add
rewrite stop name regex .*\.ofn\.io gateway.openfunction.svc.cluster.local
to the configuration file in the.:53
section, e.g:
apiVersion: v1
data:
Corefile: |
.:53 {
errors
health {
lameduck 5s
}
ready
kubernetes cluster.local in-addr.arpa ip6.arpa {
pods insecure
fallthrough in-addr.arpa ip6.arpa
ttl 30
}
rewrite stop name regex .*\.ofn\.io gateway.openfunction.svc.cluster.local
prometheus :9153
forward . /etc/resolv.conf {
max_concurrent 1000
}
cache 30
loop
reload
loadbalance
}
...
Configure nodelocaldns
based on Gateway.spec.domain
If you are also using nodelocaldns
like Kubesphere
, you need to update nodelocaldns
configuration by the following commands:
- Edit the
nodelocaldns
configmap:
kubectl -n kube-system edit cm nodelocaldns -o yaml
- Add
ofn.io:53
section to the configuration file, e.g:
apiVersion: v1
data:
Corefile: |
ofn.io:53 {
errors
cache {
success 9984 30
denial 9984 5
}
reload
loop
bind 169.254.25.10
forward . 10.233.0.3 {
force_tcp
}
prometheus :9253
}
cluster.local:53 {
errors
cache {
success 9984 30
denial 9984 5
}
reload
loop
bind 169.254.25.10
forward . 10.233.0.3 {
force_tcp
}
prometheus :9253
health 169.254.25.10:9254
}
.:53 {
errors
cache 30
reload
loop
bind 169.254.25.10
forward . /etc/resolv.conf
prometheus :9253
}
...
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.