You can change a service type of a kubernetes service using.
kubectl edit svc <ServiceName>
And, change the type here.
But, instead of editing like this, you can use patch command also.
kubectl patch svc <ServiceName> -p '{"spec": {"type": "ClusterIP"}}'
kubectl patch svc <ServiceName> -p '{"spec": {"type": "LoadBalancer"}}'
You can change ports also by following below structure.
kubectl patch svc <my_service> -p '{"spec": {"ports": [{"port": 443,"targetPort": 443,"name": "https"},{"port": 80,"targetPort": 80,"name": "http"}],"type": "LoadBalancer"}}'
Reference: Stackoverflow
No comments:
Post a Comment