Skip to content

Commit 8035145

Browse files
committed
Describe how to add additional hostnames to be resolved in the cluster
1 parent 79c4749 commit 8035145

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

docs/self-hosted/kubernetes-troubleshooting.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,66 @@ flushdb
8686

8787
Afterwards, run `composer update mirrors` to make sure all repository references are up-to-date.
8888

89+
#### The application is not able to resolve the hostnames of internal services - for example when accessing a GitLab server in a local network
8990

91+
Kubernetes clusters use their own DNS resolution mechanism. Even if the host server can resolve local hostnames (through
92+
local DNS servers or `/etc/resolv.conf`), these names are not resolvable within the cluster.
93+
94+
You can configure additional hostnames to be resolved by the cluster by following the instructions below.
95+
96+
Make a backup of the current `coredns` config to a yaml file in case you need to revert changes or want to keep it as
97+
a reference:
98+
```
99+
kubectl -n kube-system get configmap coredns -o yaml > coredns-config.yaml
100+
```
101+
102+
Start editing the `coredns` config by issuing the following command:
103+
```
104+
kubectl -n kube-system edit configmap coredns
105+
```
106+
107+
This will open the current `coredns` config in your default editor. Add all additional hostnames with corresponding IPs to the `hosts` config block.
108+
If the `hosts` config block doesn't exist yet, please add it.
109+
110+
**Important:** Add the `fallthrough` entry as the last entry in order to resolve all other hostnames that are not listed in the `hosts` config block!
111+
112+
The full configuration should look similar to this:
113+
```
114+
data:
115+
Corefile: |
116+
.:53 {
117+
errors
118+
health {
119+
lameduck 5s
120+
}
121+
ready
122+
kubernetes cluster.local in-addr.arpa ip6.arpa {
123+
pods insecure
124+
fallthrough in-addr.arpa ip6.arpa
125+
ttl 30
126+
}
127+
prometheus :9153
128+
forward . /etc/resolv.conf {
129+
max_concurrent 1000
130+
}
131+
hosts {
132+
10.1.2.3 your-gitlab-server-hostname.local
133+
fallthrough
134+
}
135+
cache 30
136+
loop
137+
reload
138+
loadbalance
139+
}
140+
```
141+
142+
143+
Restart coredns to apply the changes:
144+
```
145+
kubectl -n kube-system rollout restart deployment coredns
146+
```
147+
148+
To verify that the configured hostnames can now be correctly resolved, use this command:
149+
```
150+
kubectl exec -it $(kubectl get pods -o name | grep worker | head -1 | cut -d'/' -f2) -- nslookup your-gitlab-server-hostname.local
151+
```

0 commit comments

Comments
 (0)