当前位置:网站首页>Analysis of abnormal problems in domain name resolution in kubernetes

Analysis of abnormal problems in domain name resolution in kubernetes

2022-06-24 08:07:00 I have nothing to do with you

background :

build by oneself kubernetes1.16 colony , Most of the early service applications were php application .docker encapsulation nginx+php-fpm base image , Package the code into image jenkins Conduct ci/cd structure .

php An error is reported in the application that the domain name resolution of the boss fails .....what? Began to doubt kubernets Version of the problem , Also suspected network components . But I couldn't find the reason . Today, when Baidu was searching for information, I came across :https://www.it1352.com/589254.html, See what he solved above curl When retrieval takes too long curl It specifies CURL_IPRESOLVE_V4. Just think about it ... Yes. . My cluster is not disabled ipv6! To highlight the :

If it's on IPv6,curl By default, priority will be given to parsing IPv6, There is no... In the corresponding domain name IPv6 Under the circumstances , Will wait for IPv6 dns Parse failure timeout After that, we will go to find... According to the previous normal process IPv4

About the solution :

Just think about it, there are two solutions :

  1. work Node disabled ipv6

2 php The code specifies CURL_IPRESOLVE_V4

Start to solve :

1. About work Node disabled ipv6

reference :https://blog.csdn.net/wh211212/article/details/80996364

I am direct sysctl Set disable IPv6 The way of the , Do not want to restart cluster nodes !

 stay /etc/sysctl.conf Add the following line 
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1

#  Or perform 
sed -i '$ a\net.ipv6.conf.all.disable_ipv6 = 1\nnet.ipv6.conf.default.disable_ipv6 = 1' /etc/sysctl.conf

 To make the settings effective , Please perform 
sysctl -p

2. About php Code changes

reference :https://www.jb51.net/article/39788.htm, Just throw it to php Little buddy .... After all, I won't php.

Other references :

1. k8s – coredns Ban ipv6 analysis

2. Use in container nscd Cache optimization DNS analysis

原网站

版权声明
本文为[I have nothing to do with you]所创,转载请带上原文链接,感谢
https://yzsam.com/2021/06/20210628191923544G.html