Home > Blockchain >  Is there any way to disable or increase port name length in Kubernetes?
Is there any way to disable or increase port name length in Kubernetes?

Time:08-12

I'm trying to create a deployment on Kubernetes but getting this error;

http.paths[0].backend.service.port.name: Invalid value: \"<deployment-name>-service\": must be no more than 15 characters"

I don't have any chance to interfere to the port name directly, but deployment name. I have to pass long deployment name, but it's not possible right now. How can I solve this issue?

CodePudding user response:

You can not disable or increase port name length in kubernetes . As @Sascha Doerdelmann mentioned, it's a k8s limitation that port names are 15 characters.

According to RFC 6335.

Valid service names are hereby normatively defined as follows:

  1. MUST be at least 1 character and no more than 15 characters long.

  2. MUST contain only US-ASCII [ANSI.X3.4-1986] letters 'A' - 'Z' and 'a' - 'z', digits '0' - '9', and hyphens ('-', ASCII 0x2D or decimal 45).

  3. MUST contain at least one letter ('A' - 'Z' or 'a' - 'z').

  4. MUST NOT begin or end with a hyphen.

  5. hyphens MUST NOT be adjacent to other hyphens.

CodePudding user response:

you can truncate the value and set it to the limit that is allowed

    - port: {{ .Values.service.port }}
      targetPort: http
      protocol: TCP
      name: {{ include "helm-chart.fullname" . | trunc 7 }}-service

helm-fuction-trunc

  • Related