资讯动态

Teleport EKS 集群自动接入失败排查:解析 eks-missing-endpoint-public-access(缺少公网端点)问题

发布时间:2026/9/21 2:08:01 来源:尧图企业网站定制
网络安全认证鉴权运维后端【免费下载链接】teleportThe easiest, and most secure way to access and protect all of your infrastructure.项目地址https://gitcode.com/gh_mirrors/tel/teleport点击查看免费下载Teleport 在 Teleport Cloud 环境中通过 AWS OIDC Integration 自动发现并接入Auto Discovery / Auto EnrollmentAmazon EKS 集群时要求目标集群必须可以被公网访问否则无法部署 Teleport Kubernetes Agent。本指南围绕用户任务UserTask描述文档eks-missing-endpoint-public-access原文见 lib/usertasks/descriptions/eks-missing-endpoint-public-access.md结合仓库源码讲解该问题的触发条件、底层判定逻辑、在 Teleport 界面中的呈现方式以及完整的修复步骤。读完本文你将能准确识别这一报错、定位其产生原因并通过 AWS 控制台或命令行快速恢复 EKS 集群的自动接入。问题定义EKS 集群必须公网可达才能部署 Agent该用户任务的标题与说明非常简洁核心就一句话The EKS Cluster must be publicly accessible in order for Teleport to deploy the Teleport Kubernetes Agent.You can enable the public endpoint by accessing the Manage Endpoint Access.其含义是Teleport 在将 EKS 集群纳入管理时需要在集群内安装 Teleport Kubernetes Agent以 Helm Chart / StatefulSet 形式运行。如果 EKS 集群的 API Server 端点仅配置为私网Private endpoint而关闭了公网端点Public endpoint并且 Teleport 部署在 Teleport Cloud 环境中那么 Teleport 将无法访问集群 API从而无法安装并部署 Agent自动接入即告失败。在仓库中这个问题的类型标识IssueType被定义为字符串常量// AutoDiscoverEKSIssueMissingEndpoingPublicAccess is used to identify clusters that failed to auto-enroll // because they dont have a public endpoint and this Teleport Cluster is running in Teleport Cloud. AutoDiscoverEKSIssueMissingEndpoingPublicAccess eks-missing-endpoint-public-access见 api/types/usertasks/object.go。注意两点一是该问题仅与 Teleport Cloud 环境相关二是它隶属于 EKS 自动发现/接入Auto Discover EKS用户任务的五个已知问题类型之一完整列表见同一文件DiscoverEKSIssueTypes包括eks-status-not-active、eks-missing-endpoint-public-access、eks-authentication-mode-unsupported、eks-cluster-unreachable、eks-agent-not-connecting。触发场景EKS 自动发现与自动接入的完整链路该问题出现在 Teleport 的AWS 自动发现Auto Discovery流程中。整体链路为用户配置AWS OIDC Integrationapi/proto/teleport/integration/v1/awsoidc_service.proto用于授予 Teleport 访问 AWS 资源的权限Teleport 调用ListEKSClusters列出某个 Region 下的 EKS 集群并附带集群的详细属性Teleport 调用EnrollEKSClusters对每个符合条件的集群执行自动接入安装 Teleport Kube Agent某个集群接入失败时结果中携带IssueType字段用于区分失败类别见 api/proto/teleport/integration/v1/awsoidc_service.proto 中EnrollEKSClusterResult的定义IssueTypecontains the UserTasks issue type for well-known errors. Example of allowed values:eks-status-not-active、eks-missing-endpoint-public-access、eks-authentication-mode-unsupported、eks-cluster-unreachable、eks-agent-not-connecting。在列表阶段Teleport 已经从 AWS 的DescribeCluster结果中读取了 VPC 配置信息。EndpointPublicAccess字段在 lib/integrations/awsoidc/eks_list_clusters.go 中定义如下// EndpointPublicAccess indicates whether the Clusters VPC Config has its endpoint as a public address. // For Teleport Cloud, this is required to access the cluster and proceed with the installation. EndpointPublicAccess bool该字段由cluster.ResourcesVpcConfig.EndpointPublicAccess直接映射而来是后续判定eks-missing-endpoint-public-access的关键数据来源。源码级成因enrollEKSCluster 中的判定逻辑自动接入单个集群的核心实现位于 lib/integrations/awsoidc/eks_enroll_clusters.go 的enrollEKSCluster函数。该函数按顺序执行一系列前置检查任何一步不满足都会直接返回对应的 IssueType 与错误信息DescribeCluster调用 AWS EKS API 获取集群详情失败则直接报错状态检查集群Status必须为ACTIVE否则返回eks-status-not-active公网端点检查本文主题// We cant discover private EKS clusters for cloud clients, since we know that auth server is running in our VPC. if req.IsCloud !eksCluster.ResourcesVpcConfig.EndpointPublicAccess { return , usertasks.AutoDiscoverEKSIssueMissingEndpoingPublicAccess, trace.AccessDenied(cant enroll %q because it is not accessible from Teleport Cloud, please enable endpoint public access in your EKS cluster and try again., clusterName) }这里有两个必要条件同时成立才会触发该问题req.IsCloud为true即 Teleport 运行在 Teleport Cloud其 Auth Server 位于 Teleport 自己的 VPC 内并且集群 VPC 配置中EndpointPublicAccess为false。此时 Teleport 无法从自己的网络访问集群 APIAgent 自然无法部署。返回给用户的错误信息原文为cant enroll EKS3 because it is not accessible from Teleport Cloud, please enable endpoint public access in your EKS cluster and try again.认证模式检查集群AccessConfig.AuthenticationMode必须是API或API_AND_CONFIG_MAP否则返回eks-authentication-mode-unsupportedCONFIG_MAP模式下 API 不可用Teleport 无法安装 Helm ChartAccess Entry 关联为接入主体创建/关联访问条目并授予策略安装 Agent通过 Helm 安装 Teleport Kube Agent若 Agent 后续无法连接 Teleport 则表现为eks-agent-not-connecting。由此可见eks-missing-endpoint-public-access是整个接入流程中发生在较早阶段的一个可提前避免的问题它不属于 Agent 运行时的瞬时故障而是集群网络配置不满足接入前提的确定性失败。问题在 Teleport 中的呈现UserTask 用户任务机制当自动接入失败时Teleport 会生成一个UserTask用户任务把失败的集群与上述 IssueType 关联起来并在 Web UI 中向管理员展示问题描述与修复指引。这一机制的实现细节如下描述文档的加载方式所有已知问题类型的说明都存放在 lib/usertasks/descriptions/ 目录下以issue-type.md命名本文主题即eks-missing-endpoint-public-access.md。这些 Markdown 文件通过//go:embed编译进二进制见 lib/usertasks/descriptions.go//go:embed descriptions/*.md var descriptionsFS embed.FS func loadIssueTitleDescription(issueType string) (string, string) { filename : fmt.Sprintf(descriptions/%s.md, issueType) bs, err : descriptionsFS.ReadFile(filename) ... title : documentParts[0] if !strings.HasPrefix(title, # ) { return , } title title[2:] description : strings.TrimSpace(documentParts[1]) return title, description }即文档第一行以#开头被解析为问题标题其余部分被解析为问题说明与修复步骤。DescriptionForDiscoverEKSIssue等导出函数见 lib/usertasks/descriptions.go供上层调用将标题和描述渲染到 Web UI 中。控制台直达链接的富化URL 增强为了让管理员能够一键进入 AWS 控制台修复问题lib/usertasks/urls.go中的EKSClustersWithURLs会根据 IssueType 为每个失败集群附加对应的 AWS 控制台 URL见 lib/usertasks/urls.go// ManageEndpointAccessURL is the URL to open the EKS in Amazon Web Console, in the Manage Endpoint Access page. // Present when issue is of type eks-cluster-unreachable and eks-missing-endpoint-public-access. // Format: https://console.aws.amazon.com/eks/home?regionregion#/clusters/cluster-name/manage-endpoint-access ManageEndpointAccessURL string json:manageEndpointAccessUrl,omitemptyURL 的拼接逻辑在 lib/usertasks/urls.go当 IssueType 为eks-missing-endpoint-public-access或eks-cluster-unreachable时会在集群基础 URL 上追加/manage-endpoint-access片段从而直接定位到 AWS EKS 控制台的Manage Endpoint Access页面——这与原文档指引的修复入口完全一致case usertasksapi.AutoDiscoverEKSIssueClusterUnreachable, usertasksapi.AutoDiscoverEKSIssueMissingEndpoingPublicAccess: clusterBaseURL.Fragment clusterBaseURL.Fragment /manage-endpoint-access ret.ManageEndpointAccessURL clusterBaseURL.String()此外每个集群还会附带ResourceURL指向 EKS 控制台的集群详情页方便管理员先确认集群状态再决定如何修复。修复步骤开启 EKS 集群的公网端点根据原文档指引修复方式是访问 EKS 控制台的 Manage Endpoint Access 页面并启用公网端点。具体操作如下。方式一AWS 控制台对应原文档指引打开 AWS 管理控制台进入Amazon EKS在左侧选择集群点击目标集群即 UserTask 中报错的集群进入Networking网络或Manage endpoint access管理端点访问页面该页面即ManageEndpointAccessURL指向的地址在Endpoint access配置中将Public endpoint公网端点设为Enabled保存配置。AWS 会更新集群的ResourcesVpcConfig将EndpointPublicAccess置为true返回 Teleport等待下一次自动接入重试或手动重新发起对目标集群的接入。方式二AWS CLI等价的命令行操作对于偏好命令行或需要批量处理的管理员可以使用 AWS CLI 的update-cluster-config更新集群 VPC 配置将endpointPublicAccess设置为trueaws eks update-cluster-config \ --region region \ --name cluster-name \ --resources-vpc-config endpointPublicAccesstrue说明endpointPublicAccess字段与仓库源码中读取的cluster.ResourcesVpcConfig.EndpointPublicAccess一一对应见 lib/integrations/awsoidc/eks_list_clusters.go即 Teleport 正是通过该字段判断集群是否公网可达。修改完成后集群 VPC 配置变更会被 AWS 异步应用可在控制台或通过aws eks describe-cluster --name cluster-name确认。修复后的确认在 AWS 侧确认集群状态为ACTIVE且 Networking 中公网端点已启用在 Teleport 侧确认对应 UserTask 状态更新或消失目标集群出现在 Kubernetes 资源列表中若仍然失败可结合其他 IssueType如eks-cluster-unreachable、eks-agent-not-connecting进一步排查网络连通性与 Agent 连接问题。安全权衡与相关问题区分安全注意事项启用公网端点意味着 EKS API Server 将暴露在公网需要权衡安全性。建议在开启公网端点的同时通过 AWS 的Public access CIDRs公网访问 CIDR 白名单将可访问的源 IP 范围限制在必要的最小集合内如公司出口 IP 或 Teleport Cloud 相关网段避免 API Server 对全网开放。若企业安全策略禁止任何公网暴露则应评估自建非 CloudTeleport 部署方案或通过 VPC Peering / PrivateLink 等网络方案打通网络后再接入。与 eks-cluster-unreachable 的区分仓库代码明确区分了两个语义相近的问题类型见 api/types/usertasks/object.goeks-missing-endpoint-public-access仅在Teleport Cloud场景触发req.IsCloud true是集群配置不满足公网可达前提的确定性判定无需实际建连即可报出eks-cluster-unreachable用于Teleport 无法访问集群 API的场景适用于非 Cloud自建部署或其他网络不通的情况如安全组、VPC 路由、IAM 权限等导致的连通性失败。两者在 URL 富化时都会附加ManageEndpointAccessURL因为修复路径通常一致开放公网端点或调整网络。排查时先确认部署形态Teleport Cloud 环境优先检查公网端点自建环境优先检查网络连通性。测试与验证仓库为这一判定逻辑提供了完整的单元测试见 lib/integrations/awsoidc/eks_enroll_clusters_test.go。测试构造了一个EndpointPublicAccess: false的集群EKS3断言自动接入返回的错误信息与 IssueType 完全匹配require.EqualError(t, err, cant enroll EKS3 because it is not accessible from Teleport Cloud, please enable endpoint public access in your EKS cluster and try again.) require.Equal(t, eks-missing-endpoint-public-access, response.Results[0].IssueType)同文件还覆盖了EndpointPublicAccess: true时正常继续执行后续接入流程的场景以及eks-status-not-active、eks-authentication-mode-unsupported等其他问题类型共同保证了enrollEKSCluster前置检查顺序与错误分类的正确性。相关 URL 富化逻辑也有对应的测试见 lib/usertasks/urls_test.go验证ManageEndpointAccessURL生成格式为https://console.aws.amazon.com/eks/home?regionregion#/clusters/cluster-name/manage-endpoint-access。小结eks-missing-endpoint-public-access是 Teleport Cloud 在 EKS 自动接入场景下的一个网络前置条件检查问题只要目标集群未开启公网端点Teleport 便无法部署 Kubernetes Agent并会以 UserTask 形式在 Web UI 中提示管理员通过Manage Endpoint Access页面启用公网端点。本文从 lib/integrations/awsoidc/eks_enroll_clusters.go 的判定源码、lib/usertasks/descriptions.go 的描述加载机制到 lib/usertasks/urls.go 的直达链接富化完整还原了该问题的产生、呈现与修复闭环。遇到此类报错时按控制台/CLI 开启公网端点 → 确认集群 ACTIVE → 重试接入的顺序操作即可解决若属自建 Teleport 部署则应按eks-cluster-unreachable的网络连通性方向排查。赞分享网络安全认证鉴权运维后端【免费下载链接】teleportThe easiest, and most secure way to access and protect all of your infrastructure.项目地址https://gitcode.com/gh_mirrors/tel/teleport点击查看免费下载相关推荐Teleport EKS 集群自动注册排障eks-agent-not-connectingKube Agent 未连接问题全解析Teleport EKS 集群自动注册排障eks agent not connectingKube Agent 未连接问题全解析 在 Teleport 的网络安全认证鉴权运维后端Teleport EKS 自动发现失败排查Authentication Mode 不受支持eks-authentication-mode-unsupportedTeleport EKS 自动发现失败排查Authentication Mode 不受支持eks authentication mode unsupport网络安全认证鉴权运维后端上一篇3步实战配置IYUU自动辅种工具Docker部署全攻略下一篇让PDF焕发新生OCRmyPDF数据流全解析创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

读完文章,也想定制专属网站?

尧图设计师 24 小时内与您沟通定制方案

免费获取报价