.NET Framework network IO issues
Is this a request for help?: yes
Is this an ISSUE or FEATURE REQUEST? (choose one): ISSUE
What version of aks-engine?: v0.31.0
Kubernetes version:1.13.3
What happened: I deployed an aks-engine cluster with 1 master node and 3 windows 2019 nodes. I deployed them in a seperate vnet but with a range that allows me to connect it to our non-prod vnet. (So not the default networking settings). I deployed a container which requires some external services on our non-prod vnet. Most of the network calls (azuresql, azure table storage, azure blob storage, and some internal services seem to work fine. Except one. an simple http call to a service running on an machine on port 2018 constantly fails with:
System.AggregateException: One or more errors occurred.
---> System.AggregateException: One or more errors occurred.
---> System.Net.Http.HttpRequestException: An error occurred while sending the request.
---> System.Net.WebException: Unable to connect to the remote server
---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 10.198.17.79:2018
at System.Net.Sockets.Socket.InternalEndConnect(IAsyncResult asyncResult)
at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
When trying the exact same call with powershell on the pod it works just fine:
> invoke-restmethod -Method Get -Uri 'http://10.198.17.79:2018/types' -Headers @{ 'customheader' = 'customvalue' }
name purpose scope
---- ------- -----
(truncated the response to protect our IP)
It honestly doesn't make sense to me, but if i run the same container on a simpler docker engine host it works just fine.
What you expected to happen: That my .NET code can open sockets properly i guess??
How to reproduce it (as minimally and precisely as possible): I don't know how to reproduce this properly. I've tried writing smaller programs that do similar things and those all just work. Right now i'm thinking in the direction of maybe a limitation in IO operations from .NET in containers? if that is even a thing?
Anything else we need to know: nothing i can think of right now.
Just a confirmation that this is not expected to work yet, or that there are known issues of the same nature is sufficient for me. I don't really expect a solution from this ticket (though it obviously would be very nice!)
👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it.
@jsturtevant any ideas here?
@elangelo If i understand correctly you have a container running inside the aks-cluster and the request to a service running outside the cluster on the vnet is failing?
It might be related to: https://github.com/Azure/aks-engine/issues/371
Indeed that is the setup we have. Now that you mention it, it is indeed only the call to the service on vnet (that is coupled to the kubernetes vnet with a peering) that is failing. My main issue is that this is only intermittent. I guess you can't give me a short explanation of what is going on?
Is the peered vnet in the same region? Can you test the call from a linux container to see if that is stable/failing as well?
- the peered vnet is indeed in the same region
- i don't have a linux hosts right now in the cluster so that would be hard. But as i have described at the top of the thread, if i just exec into the container and try to reach the service with powershell it works just fine. my bet is it would work just fine from a linux container as well..
For clarity sake I want to share the custom network settings I tried for the cluster. In theory this shouldn't be a problem as I'm able to connect to the service on the vnet just fine with powershell but networking is kind of black box magic to me so I want to make sure that the settings I used are valid. So below is what I found in the azure templates (Default Range) and what I changed it into with the (Custom Range)
| Name | Default Range | Custom Range |
|---|---|---|
| vNet CIDR | 10.0.0.0/8 | 10.198.48.0/20 |
| masterSubnet | 10.240.0.0/12 | 10.198.52.0/22 |
| kubeServiceCIDR | 10.0.0.0/16 | 10.0.0.0/16 |
| kubeDNSServiceIP | 10.0.0.10 | 10.0.0.10 |
| kubeClusterCIDR | 10.240.0.0/12 | 10.198.50.0/20 |
| firstConsecutiveStaticIP | 10.255.255.5 | 10.198.52.150 |
| windowsPoolSubnet | 10.240.0.0/12 | 10.198.48.0/20 |
What I'm a bit worried about is that the kubeServiceCIDR partially overlaps with the peered vnet. But even after reading quite some information I'm still not sure what all of these CIDR's are supposed to do.
There does seem to be several areas of overlap, which could be contributing to the issue. You don't want to your ServiceCIDR to overlap with anything you'd want to connect to outside of Kubernetes. It also appears that your kubeClusterCIDR overlaps with your vNet CIDR. Though, I would expect if there was an address conflict you wouldn't be able to have it work from powershell inside the container. There is a difference between running a container on a single docker host vs in a clustered setup, so any accidentally misconfiguration could end up being routed oddly through the various layers. I think I would at least start with trying to eliminate any network overlap, to take that out of the equation.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.