由于 http 目标代理不存在,无法删除悬空的 k8s 负载均衡器

由于 http 目标代理不存在,无法删除悬空的 k8s 负载均衡器

我正在尝试删除属于已灭绝的 k8s ingress 的转发规则、目标代理、url 映射和后端服务。

我成功删除了转发规则和目标代理,但是当我删除 url-map 时,出现了以下信息:

 gcloud compute url-maps delete k8s-um-prism-feature-password-workflow-unit-tests-prism-ingres0 --quiet
ERROR: (gcloud.compute.url-maps.delete) Could not fetch resource:
 - The url_map resource 'projects/project-id/global/urlMaps/k8s-um-prism-feature-password-workflow-unit-tests-prism-ingres0' is already being used by 'projects/project-id/global/targetHttpProxies/k8s-tp-prism-feature-password-workflow-unit-tests-prism-ingres0

k8s-tp-prism-feature-password-workflow-unit-tests-prism-ingres0不是它所属的目标代理的名称,但我继续尝试删除它并得到:

gcloud compute target-https-proxies delete k8s-tp-prism-feature-password-workflow-unit-tests-prism-ingres0 --quiet
ERROR: (gcloud.compute.target-https-proxies.delete) Could not fetch resource:
 - The resource 'projects/project-id/global/targetHttpsProxies/k8s-tp-prism-feature-password-workflow-unit-tests-prism-ingres0' was not found

答案1

如果你想强制删除 LoadBalancer,你可以这样做

kubectl edit svc YOUR_SERVICE

并寻找这一行:

  finalizers:
  - service.kubernetes.io/load-balancer-cleanup

并将其从 yaml 中删除,保存并退出,它应该会删除 LoadBalancer

相关内容