Network failures relating to liveness/readiness pod restarts on 1709
Is this a request for help?: Yes
Is this an ISSUE or FEATURE REQUEST? (choose one): Issue
What version of acs-engine?: Built from source - pulled latest as of commit 904db6a6f1e9a15c784d760f9e1d4e882c52d5db
Orchestrator and version (e.g. Kubernetes, DC/OS, Swarm) Kubernetes 1.10
What happened: When setting up kubernetes liveness/readiness checks, then forcing a pod restart by manually stopping the Application pool, DNS seems to completely fail and the pods go into a loop where the readiness/liveness checks continue to fail.
What you expected to happen: I would expect DNS to continue working after a pod is restarted due to a failed liveness check, and would also expect the pod to become available and pass the liveness/readiness checks after a restart.
How to reproduce it (as minimally and precisely as possible):
Use the following JSON template to generate ARM templates via acs-engine:
{
"apiVersion": "vlabs",
"properties": {
"orchestratorProfile": {
"orchestratorType": "Kubernetes",
"orchestratorRelease": "1.10"
},
"masterProfile": {
"count": 1,
"dnsPrefix": "[REDACTED]",
"vmSize": "Standard_D2_v2"
},
"agentPoolProfiles": [
{
"name": "windowspool1",
"count": 2,
"vmSize": "Standard_D2_v2",
"availabilityProfile": "AvailabilitySet",
"osType": "Windows"
}
],
"windowsProfile": {
"adminUsername": "azureuser",
"adminPassword": "[REDACTED]",
"windowsPublisher": "MicrosoftWindowsServer",
"windowsOffer": "WindowsServerSemiAnnual",
"windowsSku": "Datacenter-Core-1709-with-Containers-smalldisk"
},
"linuxProfile": {
"adminUsername": "azureuser",
"ssh": {
"publicKeys": [
{
"keyData": "[REDACTED]"
}
]
}
},
"servicePrincipalProfile": {
"clientId": "[REDACTED]",
"secret": "[REDACTED]",
"objectId": "[REDACTED]"
}
}
}
Once the cluster is up and running, apply a deployment with the following details:
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: sampledns-deployment
labels:
app: sampledns
spec:
replicas: 2
selector:
matchLabels:
app: sampledns
template:
metadata:
labels:
app: sampledns
spec:
containers:
- name: iis
image: microsoft/iis:windowsservercore-1709
ports:
- containerPort: 80
livenessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 120
periodSeconds: 10
readinessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 60
periodSeconds: 5
Wait 2 minutes and validate that the pods are displaying as "Ready". Connect to one of the pods via kubectl exec -it
On the pod, issue the following commands:
ping www.google.com (Resolves to an IP address, but does not ping - OK)
Invoke-WebRequest -Uri "https://www.google.com" -UseBasicParsing (Successfully returns content from google)
Invoke-WebRequest -Uri "http://localhost/" -UseBasicParsing (This just ensures that IIS is running and returns a 200 status code, so the liveness/readiness checks should work)
Now, stop the DefaultAppPool to force the liveness check to fail: Import-Module WebAdministration Stop-WebAppPool -Name "DefaultAppPool"
Leave the powershell session. If you query the state of the pods, you'll shortly see that the pod you were just connected to no longer shows as ready, and describing the pod shows it as failing liveness/readiness checks. Wait until it restarts, and connect to it again. Try to run the same commands:
ping www.google.com (FAILS - "Ping request could not find host www.google.com. Please check the name and try again")
Invoke-WebRequest -Uri "https://www.google.com" -UseBasicParsing (FAILS - "The remote name could not be resolved: 'www.google.com')
Invoke-WebRequest -Uri "http://localhost/" -UseBasicParsing (This still works locally - so it does appear that the local IIS instance is up and running)
Additionally - even though it appears that IIS is up and running and I can hit the "/" path just fine locally, the readiness check never seems to work after restarting once. Describing the logs of the pod shows this error:
Readiness probe failed: Get http://10.240.0.21:80/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers) - Note that this part of my issue seems very similar to Issue #2892, however not sure if that is or isn't related to my DNS issue.
Anything else we need to know: The deployment yaml file creates 2 pods in this deployment. While all these problems are going on with the pod that I forced to restart, everything is working just fine on the other pod.
Also, this is a windows cluster.
I'm testing this out on the latest versions:
- acs-engine 0.19.2, used to deploy:
- Kubernetes v1.11.0
- azure-cni 1.0.7
- Windows Server version 1803
Things seem to be working. Do you need to be on 1709 specifically for your app, or would 1803 work? (container & node OS version must match)
I'll try 1709 next
Here's my deployment: https://gist.github.com/PatrickLang/0df013d20d32eb98bc57456c4f73461a
And results after killing the app pool
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 7m default-scheduler Successfully assigned default/iis-1803-688b96c57b-8f5nk to 12050k8s9000
Warning Unhealthy 4m (x4 over 4m) kubelet, 12050k8s9000 Readiness probe failed: HTTP probe failed with statuscode: 503
Warning Unhealthy 4m (x3 over 4m) kubelet, 12050k8s9000 Liveness probe failed: HTTP probe failed with statuscode: 503
Normal Pulling 4m (x2 over 7m) kubelet, 12050k8s9000 pulling image "microsoft/iis:windowsservercore-1803"
Normal Killing 4m kubelet, 12050k8s9000 Killing container with id docker://iis:Container failed liveness probe.. Container will be killed and recreated.
Normal Pulled 4m (x2 over 7m) kubelet, 12050k8s9000 Successfully pulled image "microsoft/iis:windowsservercore-1803"
Normal Created 4m (x2 over 7m) kubelet, 12050k8s9000 Created container
Normal Started 4m (x2 over 7m) kubelet, 12050k8s9000 Started container
patrick@plang-h1:~/plang0711$ kubectl exec -i -t iis-1803-688b96c57b-8f5nk powershell
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
PS C:\> invoke-webrequest -UseBasicParsing http://ogfg.link
StatusCode : 200
StatusDescription : OK
Content : <html><body>Nothing to see here. I'm just a lonely API server.</body></html>
RawContent : HTTP/1.1 200 OK
@PatrickLang - I cannot use 1803. My company isn't upgrading our laptops past 1709 anytime soon, so we're kind of stuck there, since I can't build an 1803 image on my 1709 laptop. I would be interested to see if it fails for you when you explicitly try version 1709 in your cluster.
I also noticed you have kubernetes version 1.11 and I'm using 1.10. I can try changing that in my template.json and redeploying to see if that makes a difference for me or not. As to your acs-engine version, I built from source and you're using v0.19.2, so it looks like I would have a few more fixes than you. However, this has been broken for me for quite some time so I'm skeptical it's the acs-engine version.
I'll try changing my orchestrator version to 1.11 tomorrow and let you know the results. Let me know if you're able to duplicate it with specifying 1709 for your windows profile.
-Justin
@carlsoncoder - are you testing this behind your corporate proxy? May be relevant.
@caseywatson - no, I have an Azure VM deployed and am using putty on that to SSH to the linux master node, and from there doing all the kubectl commands.
@caseywatson @PatrickLang - I narrowed it down. I had the same issue with 1.11 k8s as with 1.10. However, when I re-deployed the cluster with 1803 windows nodes and deployed a 1803 container image, everything works just fine. So this appears to be an issue with windows 1709 build.
What I'm seeing is that the pod gets a network interface and has proper DNS settings, but can't pass any traffic at all. I can't access the service IP or pod ip for IIS, and the pod can't access any outside IPs including the dns server. I also tried connecting to a specific public IP (resolved from bing.com) and that won't work either.
Here's the steps I followed: Get https://gist.github.com/PatrickLang/0df013d20d32eb98bc57456c4f73461a#file-iis-1709-healthcheck-yaml
kubectl apply -f iis-1709-healthcheck.yaml
kubectl exec -i -t (pod) powershell
import-module iisadministration ; stop-website 'default web site'
exit
kubectl get pod -w # wait for the restart count to increment, then ctrl-c
kubectl exec -i -t (pod) powershell
invoke-webrequest -usebasicparsing http://www.bing.com
@dineshgovindasamy @daschott - can you investigate? Is this a known limitation in Windows Server version 1709, or a bug that could be fixed?
@carlsoncoder if you can confirm that the pod can't reach an outside IP - can you change the title of this from "DNS failure" to 'network failure' ?
I've got a cluster that has been running for a couple weeks. Was about to make it live for production hosting but have been facing some DNS and networking issues.
I'm used ACS-Engine 0.19.0 to upgrade to 1.11.0 and that improved the reliability, however as of this morning am getting network failures on all new created pods. I was having some weird intermittent readiness probes failing from the host, managed to make it more stable using a command that essentially does the http check within the container.
My issues seem to be related to / similar to this issue https://github.com/Azure/acs-engine/issues/3225
I can see 0.19.2 has some networking patches, however am unsure how to actually apply them to the existing cluster. Tried upgrading but it is currently 1.11.0 and 1.11.1 isn't out yet. Any ideas and/or expectations that the CNI upgrade might solve this?
@PatrickLang - You are correct. I am unable to connect to an outside resource even by IP address. I will update the title to be "Network Failure"
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 contribution. Note that acs-engine is deprecated--see https://github.com/Azure/aks-engine instead.