首页 > 解决方案 > io.fabric8.kubernetes.client.KubernetesClientException 消息:无法解析需求:标签值无效

问题描述

在使用 spark-submit 通过 kubernetes 部署我的 spark 作业时,无法弄清楚为什么我得到一个无效的标签值错误。它下面的日志错误表明它看到我的班级名称附加了一个美元符号,但我的班级名称中没有任何不是字母数字的内容。

io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: GET at: http://<...>/labelSelector=spark-app-selector%3Dcom.ibm.ai.admin.SparkPiAdmin$,spark-role%3Dexecutor. Message: unable to parse requirement: invalid label value: "com.admin.SparkPiAdmin$": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue',  or 'my_value',  or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?'). Received status: Status(apiVersion=v1, code=400, details=null, kind=Status, message=unable to parse requirement: invalid label value: "com.admin.SparkPi$": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue',  or 'my_value',  or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?'), metadata=ListMeta(_continue=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=BadRequest, status=Failure, additionalProperties={}).

标签: apache-sparkkubernetes

解决方案


因为你的标签上有一个$标志com.admin.SparkPi$。你需要摆脱它。

可能您的应用程序正在根据某些名称、变量或任何其他参数提供标签。可能在其他情况下这不是问题,但在 Kubernetes 中却是。


推荐阅读