Hello, a question, if I have a Deployment already created and I would like to expose it in a Service with the NodePort parameter, I know that I can do it directly in a YAML file, but how could I do it with imperative commands, can I?
Hi, thanks for answering, but they didn’t refer me to the parameter: –type=NodePort, since this is for the Service created to be of type:NodePort (I do know that), but what I want is the way to use Imperative commands, I can set the field: nodePort:32484
I understand that when editing said field, I can make ** Fixed ** the Service Port of type ** NodePort **. Because of this, I wanted to know how to Set this field Imperatively with commands.
Hello, @maktup kubectl create service nodeport xyz-service-name --tcp port:targetPort --node-port=30000-32767
In this case, you had to change manually the selector with the correct one. OR
Add correct selector in the single command: kubectl create service nodeport <service-name> --tcp port:targetPort --node-port <node-port> -o yaml --dry-run=client | kubectl set selector --local -f - ' key=value' -o yaml | kubectl create -f -