7

DNSPOD 私有地址解析

 3 years ago
source link: http://www.chenshake.com/dnspod-private-address-resolution/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
DNSPOD 私有地址解析 – 陈沙克日志

 

企业内部搭建的很多服务,都是私有地址,如果使用域名,那么就只能修改hosts文件,就算是自己搭建一套dns,其实问题也很多,因为每个人的dns server是不一样的。现在使用k8s搞CICD,服务的发布,都是使用ip+端口发布,而不是域名发布,这种方式也非常不好,以前Openshift,全部都是通过域名的方式来发布应用。

怎么使用域名的方式来发布应用,因为Ip地址都是内网的,总不能让所有人都改hosts文件。解决的办法其实也很简单,去DNSpod注册一个域名,现在域名种类太多了。你选一个自己喜欢的。价格都很便宜。10块钱左右。

https://dnspod.cloud.tencent.com/

如果你只是解析私有地址,那么其实过程简单很多,上传身份证复印件,进行实名后,大概等待几个小时,就可以开始使用。

搞完这些,你会发现,你其实已经注册了一个腾讯云的账号,腾讯云多了一个用户。

内网地址解析

在你域名下面,添加一条A记录,应该马上生效,你ping的返回的地址,就是私有IP地址。

可以通过api,脚本添加记录,马上可以生效。

% ping tools.chenshake.site
PING tools.chenshake.site (10.0.38.167): 56 data bytes
64 bytes from 10.0.38.167: icmp_seq=0 ttl=63 time=3.979 ms
64 bytes from 10.0.38.167: icmp_seq=1 ttl=63 time=2.394 ms
64 bytes from 10.0.38.167: icmp_seq=2 ttl=63 time=2.400 ms

这个其实是关键,支持泛解,可以解决很多问题。例如容器云平台的ingress,你可以通过设置

*.app.abc.com    10.0.38.167

这样设置后,你就会发现,ping xxx.app.chenshake.site , 无论xxx是什么,都会返回相同的ip地址: 192.168.1.100。

自动签发证书

这个问题就很高端,主要是要解决ingress,泛解的域名的https的问题。

  • https://imroc.cc/k8s/trick/cert-manager-webhook-dnspod/
  • https://github.com/qqshfox/cert-manager-webhook-dnspod
  • https://cloud.tencent.com/document/product/457/49368#.E9.85.8D.E7.BD.AE-dns
  • https://www.lishuai.fun/2021/08/01/k8s-create-cert-manager/

结合DNSPOD,解决证书管理的问题。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK