kubernetes: Possible Bug: `kubectl get svc --export` omits `NodePort`
We’ve defined a Service that needs to be port-bound to the host-machine on a specific port, which is then associated with our ELB. This Service fronts a Deployment that acts like our “mesh” router (which we call edge-router). When we --export a service, the nodePort we originally defined is dropped. Upon re-import, it will be assigned some random nodePort.
what
- Using
--exportwithkubectl get svccausesnodePortto be dropped, even if it was explicitly set
expectation
- Using
--exportoption should produce output that resembles original resource as submitted by usingkubectl apply - If the original resource was created with an explicit
nodePort, the value should be preserved when using--export
reproduction
- create a new service called
foowith an explicitnodePortdefined applythefooservice- run
kubectl get svc foo -o yaml --export - observe that the
nodePortis missing
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 17 (8 by maintainers)
@AdoHe Thanks - that helps explain what’s going on. I’d prefer that
--exportwork for lists as well. I also think “cluster-specific” should be qualified. Fields dynamically generated by the cluster should be stripped off with--export; however, fields that I specify should always be preserved by exports. I also think that the following fields should be stripped from exports because they were generated by the cluster. We do this currently withsed -E /\b(creationTimestamp|resourceVersion|uid|selfLink):/d.@kubernetes/kubectl I think there are two things we need to with export: 1. “cluster-specific” should be qualified, or users will get confused. 2. how export should work with list resources.
@liggitt Is there some documentation about it somewhere ? It would be interesting to have it available easily(Not on a GitHub issue).