当使用命令行Google试图为我的域更新托管区域资源记录类型A的外部IP时出错. 使用基于浏览器的gce控制台可以很好地工作。 .在英语中,当我使用Kubernetes部署我的应用程序时,它给了我一个新的IP,我需要链接到我现有的域名DNS,这样人们就可以访问我的应用程序,将浏览器指向我的域(example.com)。问题是,每当我重新部署我的应用程序时,这个动作都需要发生,因此需要自动化。
注意- Cloud区域已经存在并工作。我正在尝试更新外部IP地址,以匹配新的Kubernetes部署的LoadBalancer入侵
kubectl describe svc --namespace=ruptureofthemundaneplane | grep Ingress
LoadBalancer Ingress: 104.196.108.178
这是目前的状况
gcloud dns record-sets list --zone zone-cubalibre --project ruptureofthemundaneplane
NAME TYPE TTL DATA
example.com. A 60 104.196.108.147
example.com. NS 60 ns-cloud-a1.googledomains.com.,ns-cloud-a2.googledomains.com.,ns-cloud-a3.googledomains.com.,ns-cloud-a4.googledomains.com.
example.com. SOA 60 ns-cloud-a1.googledomains.com. cloud-dns-hostmaster.google.com. 1 21600 3600 1209600 300
admin.example.com. CNAME 60 example.com.
www.admin.example.com. CNAME 60 example.com.
www.example.com. CNAME 60 example.com.
这是A型唱片
gcloud dns record-sets list --project ruptureofthemundaneplane --zone zone-cubalibre --name "example.com." --type "A"
NAME TYPE TTL DATA
example.com. A 60 104.196.108.147
我需要用一个新的值104.196.108.178替换IP 104.196.108.147。所以我发布
gcloud dns record-sets transaction start --zone zone-cubalibre --project ruptureofthemundaneplane
在这里,我用我的新IP地址添加了一个事务。
gcloud dns record-sets transaction add "104.196.108.178" --name "example.com." --ttl 60 --type "A" --project ruptureofthemundaneplane --zone zone-cubalibre
以下是系统生成的yaml文件
cat transaction.yaml
---
additions:
- kind: dns#resourceRecordSet
name: example.com.
rrdatas:
- ns-cloud-a1.googledomains.com. cloud-dns-hostmaster.google.com. 2 21600 3600 1209600
300
ttl: 60
type: SOA
- kind: dns#resourceRecordSet
name: example.com.
rrdatas:
- 104.196.108.178
ttl: 60
type: A
deletions:
- kind: dns#resourceRecordSet
name: example.com.
rrdatas:
- ns-cloud-a1.googledomains.com. cloud-dns-hostmaster.google.com. 1 21600 3600 1209600
300
ttl: 60
type: SOA
为了完整起见,我要求系统显示事务缓存。
gcloud dns record-sets transaction describe --project ruptureofthemundaneplane --zone zone-cubalibre
..。输出
additions:
- kind: dns#resourceRecordSet
name: example.com.
rrdatas:
- ns-cloud-a1.googledomains.com. cloud-dns-hostmaster.google.com. 2 21600 3600 1209600
300
ttl: 60
type: SOA
- kind: dns#resourceRecordSet
name: example.com.
rrdatas:
- 104.196.108.178
ttl: 60
type: A
deletions:
- kind: dns#resourceRecordSet
name: example.com.
rrdatas:
- ns-cloud-a1.googledomains.com. cloud-dns-hostmaster.google.com. 1 21600 3600 1209600
300
ttl: 60
type: SOA
最后,我使用以下方法提交事务
gcloud dns record-sets transaction execute --project ruptureofthemundaneplane --zone zone-cubalibre
ERROR: (gcloud.dns.record-sets.transaction.execute)
The resource 'entity.change.additions[1]' named 'example.com. (A)' already exists (code: 409)
有什么建议吗?我想避免预先定义静态IP,因为这是不可伸缩的. 当我使用kube-up.sh在aws上部署时,等效的Amazon命令可以工作 .如果kubernetes在其所有云主机供应商之间实现了一个共同的解决方案,那将是一个很好的接触。人们是否在使用其他自动化手段来实现这一目标?lang x中的SDK库?
发布于 2016-07-15 14:40:37
Cloud操作工作在整个RR_set_s (record-set
或dns#resourceRecordSet
)上,而不是单个RRs上。即使在后一种情况下,您的示例也不会做您想做的事情,因为您最终将得到一个包含旧IP地址和新IP地址的RRset,这只会“主要工作”。
无论如何,是记录集,每个RTYPE只允许一个RRset,所以您的事务需要首先删除现有的A
RRset,然后添加新的A
RRset。
https://stackoverflow.com/questions/38341668
复制相似问题