kubectl expose deployment source-ip-app --name=loadbalancer --port=80 --target-port=8080 --type=LoadBalancer
Here is what the above code is Doing:
1. Create a deployment named source-ip-app with a single replica.
2. Expose the deployment as a service named loadbalancer.
3. The service is of type LoadBalancer, so it creates an external load balancer in the current cloud (if supported) and assigns a fixed, external IP to the service.
4. The service forwards the traffic that it receives on port 80 to port 8080 on the pod.