I'm trying to run .NET Core 2 Docker images in Kubernetes using Azure Container Service and Azure Container Registry.
I have successfully created a pod & is running perfectly. Later I deployed a service using command kubectl expose deployment depl-name --type=LoadBalancer --port=8086 --target-port=8086
& I checked service details using command kubectl get services
but the external IP exposed by Azure is not working at all. I tried to ping that IP as well but it says request timeout. I can see, application/port everything is up & okay.
Please check snaps following:
I do not follow why the public IP exposed by Azure container service does not work even when an application is running without errors on kubernetes cluster. Please let me know if anything has gone wrong.
Thanks,
Can you verify what deployments you have in your cluster
kubectl get deployments --all-namespaces
You should get a list like this
NAMESPACE NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
default my-deployment 1 1 1 1 28m
Then, expose the desired deployment
kubectl expose deployment my-deployment --type=LoadBalancer --port=8086 --target-port=80 --name=my-service
You should now be able to access the pod by browsing to 13.65.243.33:8086. If it's not working, check if your container is actually reacting on incoming requests on port 80.
The command you used does not match the output from "kubectl get services". You used --port=8080 which is saying to publicly expose port 8080 yet the get services call shows port 80 being exposed. They don't match, so this doesn't make sense. You also didn't tell kubectl what port on the container to map to, not sure what the default would be. Try this instead:
kubectl expose deployment depl-name --type=LoadBalancer --port=80 --target-port=80
Replacing the correct port numbers for your scenario of course. If it's still not working go into the Azure Portal and look at your cluster. You should see a new Load Balancer (the one without k8s-master in the name). Open it up and inspect the load balancing rules.