apache/pulsar · error · RuntimeException
Kubernetes does not allow upper case jobNames.
Error message
Kubernetes does not allow upper case jobNames.
What it means
KubernetesRuntime.doChecks() validates the derived job name because Kubernetes resource names must be RFC-1123 DNS labels (lowercase). If the job name (derived from tenant/namespace/function names or an overridden job name) contains uppercase characters, a RuntimeException is thrown before any k8s call.
Source
Thrown at pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/kubernetes/KubernetesRuntime.java:1164
final String jobNameBase = String.format("%s-%s-%s", tenant, namespace, functionName);
final String jobName = "pf-" + jobNameBase;
final String convertedJobName = toValidPodName(jobName);
if (jobName.equals(convertedJobName)) {
return jobName;
}
// toValidPodName may cause naming collisions, add a short hash here to avoid it
final String shortHash = DigestUtils.sha1Hex(jobNameBase).toLowerCase().substring(0, 8);
return convertedJobName + "-" + shortHash;
}
@VisibleForTesting
String getServiceUrl(String jobName, String jobNamespace, int instanceId) {
String suffix = isNotBlank(kubernetesServiceDomainSuffix) ? kubernetesServiceDomainSuffix : "svc.cluster.local";
return String.format("%s-%d.%s.%s.%s", jobName, instanceId, jobName, jobNamespace, suffix);
}
public static void doChecks(FunctionDetails functionDetails, String overridenJobName) {
final String jobName = createJobName(functionDetails, overridenJobName);
if (!jobName.equals(jobName.toLowerCase())) {
throw new RuntimeException("Kubernetes does not allow upper case jobNames.");
}
final Matcher matcher = VALID_POD_NAME_REGEX.matcher(jobName);
if (!matcher.matches()) {
throw new RuntimeException("Kubernetes only admits lower case and numbers. "
+ "(jobName=" + jobName + ")");
}
if (jobName.length() > maxJobNameSize) {
throw new RuntimeException("Kubernetes job name size should be less than " + maxJobNameSize);
}
}
}
View on GitHub (pinned to 820761864e)
Solutions
- Rename the function using only lowercase letters, numbers, and '-'.
- If using an overridden job name, change it to lowercase.
- Where renaming is impossible, configure a sanitized/translated job name (the runtime normally translates invalid chars — check the name isn't bypassing translation).
Example fix
// before functions create --name MyFunction ... // after functions create --name my-function ...
Defensive patterns
Strategy: validation
Validate before calling
String jobName = tenant + "-" + namespace + "-" + functionName;
if (!jobName.equals(jobName.toLowerCase())) {
throw new IllegalArgumentException("Function/job name must be lowercase for Kubernetes: " + jobName);
} Type guard
static boolean isValidK8sName(String name) {
return name != null && name.equals(name.toLowerCase());
} Try / catch
try {
functions.create(request);
} catch (RuntimeException e) {
if (e.getMessage().contains("upper case jobNames")) {
log.error("Rename function to lowercase: {}", e.getMessage());
}
throw e;
} Prevention
- Use lowercase-only function, tenant, and namespace names
- Avoid CamelCase in function metadata
- If overrides are used, ensure the overridden job name is lowercase
- Validate names client-side before submitting functions
When it happens
Trigger: Function metadata (tenant, namespace, name) or the overridden job name contains uppercase letters, producing a jobName like "MyFunction"; doChecks() rejects it via jobName.equals(jobName.toLowerCase()).
Common situations: Users create functions with CamelCase names; cluster-level custom job name overrides include capitals; older clients allowed names Kubernetes rejects.
Related errors
- Kubernetes only admits lower case and numbers. (jobName=%s)
- Invalid value for BROKER_CLIENT_TRUST_CERTS_SECRET_NAME. Exp
- Invalid value for SERVICE_ACCOUNT_TOKEN_EXPIRATION_SECONDS.
- Invalid value for SERVICE_ACCOUNT_TOKEN_AUDIENCE. Expected a
- Failed to create service for function %s
AI-assisted analysis of apache/pulsar@820761864e (2026-09-06).
Data as JSON: /api/errors/d6111170c0ad504f.
Report an issue: GitHub.