Helm安装时报错 no Endpoints with the

2024-05-23  本文已影响0人  xun66

问题描述

用Helm部署项目打包的时候,提示Upgrade failed: no Endpoints with the name "myrelease-xxxx-service" found,或Error: UPGRADE FAILED: no Endpoints with the name "myrelease-xxxx-service" found
百思不得其解。加上--debug也没有提供太多有用的信息。

Error: release myrelease failed, and has been uninstalled due to atomic being set: no Endpoints with the name "myrelease-xxxx-service" found

排查过程

相关清单文件如下:

apiVersion: v1
kind: Service
metadata:
  name: {{ include "foo.fullname" . }}-xxxx-service
  labels:
    {{- include "foo.labels" . | nindent 4 }}
    component: xxxx
spec:
  type: ClusterIP
  selector:
    {{- include "foo.selectorLabels" . | nindent 4 }}
    component: xxxx
  ports:
    - port: 8080
      targetPort: 8080
---
apiVersion: v1
kind: Endpoints
metadata:
  name: {{ include "foo.fullname" . }}-xxxx-service
subsets:
  - addresses:
      - ip: {{ .Values.xxxx.ip }}
    ports:
      - port: 8080

出门冷静了一会,回来发现了问题。当为Service指定了Endpoints时(即服务端点不是自动从集群内Pods选取时),service资源必须定义为无头服务即Headless服务。这也就要求service不能有spec.selector字段。

所以,要么删除Endpoints资源(使用集群内pod时,不需要额外给ip+port),要么删除service的spec.selector(使用外部节点,不指定pod筛选器)。此处由于我们的service实际上是要包装集群外部节点(云端托管服务),所以选择后者方案,重新打包部署,通过。

总结

Helm对中型或大型的k8s项目打包来说还是很好用的,但是这次遇到这个报错的bug,错误信息有些抽象。通过对比其他资源清单文件才发现问题所在。

参考资料

  1. https://github.com/helm/helm/issues/7967

关键词

Helm Endpoints Headless Service

上一篇 下一篇

猜你喜欢

热点阅读