Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google compute engine gcloud dns记录集事务无法更新IP地址_Google Compute Engine_Kubernetes_Google Cloud Platform_Gcloud_Google Cloud Dns - Fatal编程技术网

Google compute engine gcloud dns记录集事务无法更新IP地址

Google compute engine gcloud dns记录集事务无法更新IP地址,google-compute-engine,kubernetes,google-cloud-platform,gcloud,google-cloud-dns,Google Compute Engine,Kubernetes,Google Cloud Platform,Gcloud,Google Cloud Dns,尝试更新我的域的托管区域资源记录类型A的外部IP时,使用命令行Google Cloud DNS时出错。。。在英语中,当我使用Kubernetes部署我的应用程序时,它会给我一个新的IP,我需要链接到我现有的域DNS,这样人们可以通过指向我的域(example.com)的浏览器访问我的应用程序。。。问题是每次我重新部署应用程序时都需要执行此操作,因此需要自动化 注意-云DNS区域已经存在并正常工作。我正在尝试更新外部IP地址,以匹配新Kubernetes部署的LoadBalancer入口,如所示

尝试更新我的域的托管区域资源记录类型A的外部IP时,使用命令行Google Cloud DNS时出错。。。在英语中,当我使用Kubernetes部署我的应用程序时,它会给我一个新的IP,我需要链接到我现有的域DNS,这样人们可以通过指向我的域(example.com)的浏览器访问我的应用程序。。。问题是每次我重新部署应用程序时都需要执行此操作,因此需要自动化

注意-云DNS区域已经存在并正常工作。我正在尝试更新外部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.
这只是一张打字记录

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,因为这是不可伸缩的。。。如果kubernetes在其所有云主机供应商中实现了一个通用的解决方案,那将是一个很好的选择。。。人们是否在使用其他自动化手段来实现这一点?LangX中的一些SDK库

云DNS操作在整个RRs集(
记录集
DNS#resourceRecordSet
)上工作,而不是在单个RRs上工作。即使在后一种情况下,您的示例也无法实现您想要的功能,因为您最终会得到一个包含新旧IP地址的RRset,而这只能“大部分工作”


在任何情况下,它都是记录集,并且每个RTYPE只允许一个RRset,因此您的事务需要先删除现有的ARRset,然后添加新的。

云DNS操作在整个RRset(
记录集
DNS#resourceRecordSet
)上工作,而不是在单个RRs上工作。即使在后一种情况下,您的示例也无法实现您想要的功能,因为您最终会得到一个包含新旧IP地址的RRset,而这只能“大部分工作”

在任何情况下,它都是记录集,并且每个RTYPE只允许一个RRset,因此您的事务需要先删除现有的ARRset,然后添加新的