gpt4 book ai didi

kubernetes - 如何在GKE中使用临时IP创建Kubernetes负载均衡器?

转载 作者:行者123 更新时间:2023-12-02 12:05:44 25 4
gpt4 key购买 nike

如何配置LoadBalancer来检索临时IP而不是静态IP?

我需要这个,所以我不必等待GOOGLE从1个IP地址增加配额...(这已经是漫长的一天了...)

  Normal   EnsuringLoadBalancer        3m (x7 over 8m)  service-controller  Ensuring load balancer
Warning CreatingLoadBalancerFailed 3m (x7 over 8m) service-controller Error creating load balancer (will retry): failed to ensure load balancer for service default/subzero-react: failed to ensure a static IP for load balancer (*****************(default/subzero-react)): error creating gce static IP address: googleapi: Error 403: Quota 'STATIC_ADDRESSES' exceeded. Limit: 1.0 in region us-central1., quotaExceeded

删除 loadBalancerIp字段并重新创建服务后,它仍处于待处理状态。

这是 kubectl get service ****** -o yaml的输出:
kubectl get service **** -o yaml
apiVersion: v1
kind: Service
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"labels":{"app":"api"},"name":"subzero-react","namespace":"default"},"spec":{"ports":[{"name":"http","port":80}],"selector":{"app":"initial-pp3subzero"},"type":"LoadBalancer"}}
creationTimestamp: 2018-11-19T18:04:24Z
labels:
app: api
name: *****************
namespace: default
resourceVersion: "584211"
selfLink: /api/v1/namespaces/default/services/**********
uid: 8c140d40-ec25-11e8-b7b3-42010a8000c2
spec:
clusterIP: 10.7.242.176
externalTrafficPolicy: Cluster
ports:
- name: http
nodePort: 31853
port: 80
protocol: TCP
targetPort: 80
selector:
app: ******************
sessionAffinity: None
type: LoadBalancer
status:
loadBalancer: {}

最佳答案

要在不使用Kubernetes的GCP负载均衡器上分配静态IP(默认行为),通常不需要在loadBalancerIP服务规范中指定任何内容,如herehere所述。

您可以删除服务并重新创建它,而无需使用loadBalancerIP,也可以对其进行修补:

$ kubectl patch service <service-name> -p '{"spec": { "loadBalancerIP": null }}'

关于kubernetes - 如何在GKE中使用临时IP创建Kubernetes负载均衡器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53380452/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com