I am trying to deploy and verify my API solution to docker-desktop kubernetes. I successfully deployed my application to docker-desktop k8s, I am able to run the application using swagger with the kubectl port-forward
command. When I tried to apply deployment, service and loadbalancer yml files, I am unable to run the application in my browser. I am getting a message that localhost didn't sent any data. Below are my yml, docker files and screenshot of the error message in browser.
Not working option
Service.yml
Browser Error
Please check the above configuration on not working option and help me to identify where I did mistake.
In your service YAML you have did mistake in ports
in your deployment container port is : 45678
while inside the service target port is : 34567
ideally, it should be 45678 or 80 as the service will be forwarding the traffic to a container or we can say the pods.
also same apply for the service load balancer
where the target port is not getting a match for the pod and load balancer port. due to this matches your traffic is not getting forward to the PODS and you are not able to access the service on the browser.
keep the load balancer port 45678 and target port 45678