targetPort does not accept integer as valid
See original GitHub issuetargetPort can be an integer, but VSCode reports a linting error that it expected a “string.”
apiVersion: v1
kind: Service
metadata:
name: hello
spec:
selector:
app: hello
type: ClusterIP
ports:
- protocol: TCP
port: 80
targetPort: 8080
Issue Analytics
- State:
- Created 4 years ago
- Comments:20 (3 by maintainers)
Top Results From Across the Web
targetPort does not accept integer as valid · Issue #632 - GitHub
targetPort can be an integer, but VSCode reports a linting error that it expected a "string." apiVersion: v1 kind: Service metadata: name: ...
Read more >Cannot port forward: "not a valid redirect target port. It must be ...
“The following input errors were detected: is not a valid redirect target port. It must be a port alias or integer between 1...
Read more >How Do You Define a Kubernetes Service TargetPort as a ...
If you refer by integer, there is no need to define ports in pods at all, although it's reasonable to still do it...
Read more >1383812 – Error setting ports using parameter in template ...
Doc Text: Feature: Support using parameter references in non-string template fields. Reason: Previously parameter references could not be used ...
Read more >redirect targe port any does not work on TCP/UDP nat rule
A valid redirect target port must be specified. It must be a port alias or integer between 1 and 65535. I would take...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The difference between the fallback schema (which behaves correctly) and the schema given by Kubernetes itself is that in the fallback schema we have:
whereas live clusters tell us to use:
The latter feels semantically less correct, though arguably Red Hat YAML mishandled it by requiring the quotation marks; I wonder if we should raise an issue against upstream k8s to represent it using the
oneOf
form.In any case, we can massage it when we retrieve it from the cluster. And now I have a repro I can actually confirm the massaging works.
Thanks everyone for your patience. Hopefully I’ll have a fix for you soon.
Closed via #636.