What happened:
Creating a k8s cluster using an existing vnet, the cluster is unable to create routes in the Azure Route table, and is therefore unable to schedule any pods.
How to reproduce it:
- Create a custom vnet
- Configure the template and deploy
When the cluster is up, the nodes report as ready:
gfadmin@k8s-master-35738843-0:~$ kubectl get nodes
NAME STATUS AGE
k8s-agentpool1-35738843-0 Ready 16h
k8s-agentpool1-35738843-1 Ready 16h
k8s-agentpool1-35738843-2 Ready 16h
k8s-master-35738843-0 Ready,SchedulingDisabled 16h
Wtih NetworkUnavailable message of RouteController failed tocreate a route:
gfadmin@k8s-master-35738843-0:~$ kubectl describe node k8s-master-35738843-0
Name: k8s-master-35738843-0
Labels: beta.kubernetes.io/arch=amd64
beta.kubernetes.io/instance-type=Standard_D2_v2
beta.kubernetes.io/os=linux
failure-domain.beta.kubernetes.io/region=westus
failure-domain.beta.kubernetes.io/zone=0
kubernetes.io/hostname=k8s-master-35738843-0
Taints: <none>
CreationTimestamp: Wed, 23 Nov 2016 18:40:52 +0000
Phase:
Conditions:
Type Status LastHeartbeatTime LastTransitionTime Reason Message
---- ------ ----------------- ------------------ ------ -------
OutOfDisk False Thu, 24 Nov 2016 11:02:41 +0000 Wed, 23 Nov 2016 18:40:52 +0000 KubeletHasSufficientDisk kubelet has sufficient disk space available
MemoryPressure False Thu, 24 Nov 2016 11:02:41 +0000 Wed, 23 Nov 2016 18:40:52 +0000 KubeletHasSufficientMemory kubelet has sufficient memory available
DiskPressure False Thu, 24 Nov 2016 11:02:41 +0000 Wed, 23 Nov 2016 18:40:52 +0000 KubeletHasNoDiskPressure kubelet has no disk pressure
Ready True Thu, 24 Nov 2016 11:02:41 +0000 Wed, 23 Nov 2016 18:40:52 +0000 KubeletReady kubelet is posting ready status
NetworkUnavailable True Thu, 24 Nov 2016 11:02:47 +0000 Thu, 24 Nov 2016 11:02:47 +0000 NoRouteCreated RouteController failed tocreate a route
Looking at the kube-controller logs (/var/log/containers):
routecontroller.go:132] Could not create route 5cb8901d-b1ac-11e6-89eb-000d3a32ff9f 10.244.2.0/24 for node k8s-master-35738843-0 after 38.691596ms: network.SubnetsClient#Get: Failure responding to request: StatusCode=404 -- Original Error: autorest/azure: Service returned an error. Status=404 Code=\"ResourceNotFound\" Message=\"The Resource 'Microsoft.Network/virtualNetworks/subscriptions' under resource group 'ACSRG2' was not found.\"\n","stream":"stderr","time":"2016-11-23T18:51:29.914307462Z"}
Notice the error message has an malform resource: Microsoft.Network/virtualNetworks/subscriptions.
Workaround
We've deduced this to the /etc/kubernetes/azure.json expecting unqualified names for both the vnet and subnet. Instead, the fully-qualified names are present:
{
...
"subnetName": "/subscriptions/76aabf62-fa6e-41ac-a2f3-5532b22811b5/resourceGroups/ACSRG2/providers/Microsoft.Network/virtualNetworks/k8s-vnet-test/subnets/k8s-subnet-test",
"securityGroupName": "...",
"vnetName": "/subscriptions/76aabf62-fa6e-41ac-a2f3-5532b22811b5/resourceGroups/ACSRG2/providers/Microsoft.Network/virtualNetworks/k8s-vnet-test",
...
}
After changing the subnet and vnet to unqualified names and restarting kubelet, we see the routes as being created and things are back to normal.
Much of the credit in debugging this goes to @jamesbak.
What happened:
Creating a k8s cluster using an existing vnet, the cluster is unable to create routes in the Azure Route table, and is therefore unable to schedule any pods.
How to reproduce it:
When the cluster is up, the nodes report as ready:
Wtih NetworkUnavailable message of RouteController failed tocreate a route:
Looking at the kube-controller logs (/var/log/containers):
Notice the error message has an malform resource:
Microsoft.Network/virtualNetworks/subscriptions.Workaround
We've deduced this to the
/etc/kubernetes/azure.jsonexpecting unqualified names for both the vnet and subnet. Instead, the fully-qualified names are present:After changing the subnet and vnet to unqualified names and restarting kubelet, we see the routes as being created and things are back to normal.
Much of the credit in debugging this goes to @jamesbak.