Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve Consul DNS in OpenShift #20439

Merged
merged 4 commits into from
Feb 1, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions website/content/docs/k8s/dns.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,68 @@ in full cluster rebuilds.

-> **Note:** If using a different zone than `.consul`, change the key accordingly.

## OpenShift DNS Operator

natemollica-nm marked this conversation as resolved.
Show resolved Hide resolved
You can use DNS forwarding to override the default forwarding configuration in the `/etc/resolv.conf` file by specifying
the `consul-dns` service for the `consul` subdomain (zone).

Find `consul-dns` service clusterIP:

```shell-session
$ oc get svc consul-dns --namespace consul --output jsonpath='{.spec.clusterIP}'
172.30.186.254
```

Edit the `default` DNS Operator:

```shell-session
$ oc edit edit dns.operator/default
```

Append the following `servers` section entry to the `spec` section of the DNS Operator configuration:

```yaml
spec:
servers:
- name: consul-server
zones:
- consul
forwardPlugin:
policy: Random
upstreams:
- 172.30.186.254 # Set to clusterIP of consul-dns service
```

Save the configuration changes and verify the `dns-default` configmap has been updated:

```shell-session
$ oc get configmap/dns-default -n openshift-dns -o yaml
```

Example output with updated `consul` forwarding zone:

```yaml
...
data:
Corefile: |
# consul-server
consul:5353 {
prometheus 127.0.0.1:9153
forward . 172.30.186.254 {
policy random
}
errors
log . {
class error
}
bufsize 1232
cache 900 {
denial 9984 30
}
}
...
```

## Verifying DNS Works

To verify DNS works, run a simple job to query DNS. Save the following
Expand Down
Loading