harbor icon indicating copy to clipboard operation
harbor copied to clipboard

DNS lookup cached by nginx

Open chlins opened this issue 2 years ago • 0 comments

How can we help you?

The nginx will cache the DNS lookup result in the memory, so in the case of core restarted and IP changed then nginx still records the wrong old IP for core, that may lead to harbor service can not be available, because the requests may redirect to the incorrect address.

Example: (the nginx redirect core requests to jobservice)

nginx [ / ]$ curl -L https://127.0.0.1:8443/api/version -k
{"code":10011,"message":"unauthorized","details":"header 'Authorization' missing"}nginx [ / ]$
nginx [ / ]$ curl http://core:8080/api/version
{"version":"v2.0"}

Similar issue in the community: https://github.com/goharbor/harbor/issues/14209#issuecomment-781274170

A fast workaround for the issue is restarting the nginx container.

chlins avatar Nov 11 '22 08:11 chlins