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:
MUST be at least 1 character and no more than 15 characters long.
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).
MUST contain at least one letter ('A' - 'Z' or 'a' - 'z').
MUST NOT begin or end with a hyphen.
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