Helm安装时报错 no Endpoints with the name "xxxx-service" found

问题描述

用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

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,982评论 19 139
  • Kubernetes 简介 Kubernetes 是什么? Kubernetes 是一个可移植的、可扩展的开源平台...
    王勇1024阅读 760评论 0 2
  • 简述ETCD及其特点? etcd 是 CoreOS 团队发起的开源项目,是一个管理配置信息和服务发现(servic...
    成浅阅读 364评论 0 1
  • 文章目录 Helm2和Helm3的安装与卸载 关于Helm 在Kubernetes上进行容器化部署并非易事,doc...
    彩色的炮灰阅读 1,168评论 0 1
  • 容器技术概念入门篇 从进程说开去 容器本身没有价值,有价值的是“容器编排”。 容器其实是一种沙盒技术。顾名思义,沙...
    白板时钟阅读 2,566评论 0 2