Change:
Is this a BUG REPORT or FEATURE REQUEST?: /kind bug /area cloudprovider /sig azure What happened: I've created a service of type in a Kubernetes cluster created via the ACS Engine. The load balancer has been created correctly after some time and a random NodePort (at this time ) has been allocated. However, in the Azure Portal I'm seeing that the health probe of that load balancer is pointing to port which does not exist in the whole Kubernetes system at all. Because of that wrongly configured health probe the load balancer is not reachable (i/o timeout). What you expected to happen: The health probe would have been configured to NodePort . How to reproduce it (as minimally and precisely as possible): Unfortunately, it does not behave always like this but only occasionally. In some cases the health probe gets configured correctly, but in others not. I've used the following manifest: Anything else we need to know?: When updating the health probe manually to the correct NodePort in the Azure portal, the load balancer starts to work properly. Environment: Kubernetes version (use ): 1.7.5 Cloud provider or hardware configuration: Azure Install tools: ACS Engine Others: -
Thanks for reporting the problem. Could you share the service spec after it is created? e.g. by running . And may I ask whether there is a service just removed with same name before this one?
Sure, thanks, please find the manifest below [1]. In fact I'll have some other services with the same name, but in other namespaces. In the namespace I didn't have a service named before. [1] Service manifest after creation
Filed PR , which should fix the problem. Need cherry-picked to v1.7 branch after it is merged.
Thank you very much that was really fast!
has been merged. created cherry pick PR for release 1.7.

Discussion:
go_test( name = "go_default_test", srcs = [ <ins> "azure_loadbalancer_test.go", </ins> "azure_test.go", "azure_util_test.go", ],

func findProbe(probes []network.Probe, probe network.Probe) bool { for _, existingProbe := range probes { <del> if strings.EqualFold(*existingProbe.Name, *probe.Name) { </del> <ins> if strings.EqualFold(*existingProbe.Name, *probe.Name) && *existingProbe.Port == *probe.Port { </ins> return true } }

<ins> /* Copyright 2017 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package azure import ( "fmt" "testing" "github.com/Azure/azure-sdk-for-go/arm/network" "github.com/Azure/go-autorest/autorest/to" "github.com/stretchr/testify/assert" ) func TestFindProbe(t *testing.T) { tests := []struct { msg           string existingProbe []network.Probe curProbe      network.Probe expected      bool }{ { msg:      "empty existing probes should return false", expected: false, }, { msg: "probe names match while ports unmatch should return false", existingProbe: []network.Probe{ { Name: to.StringPtr("httpProbe"), ProbePropertiesFormat: &network.ProbePropertiesFormat{ Port: to.Int32Ptr(1), }, }, }, curProbe: network.Probe{ Name: to.StringPtr("httpProbe"), ProbePropertiesFormat: &network.ProbePropertiesFormat{ Port: to.Int32Ptr(2), }, }, expected: false, }, { msg: "probe ports match while names unmatch should return false", existingProbe: []network.Probe{ { Name: to.StringPtr("probe1"), ProbePropertiesFormat: &network.ProbePropertiesFormat{ Port: to.Int32Ptr(1), }, }, }, curProbe: network.Probe{ Name: to.StringPtr("probe2"), ProbePropertiesFormat: &network.ProbePropertiesFormat{ Port: to.Int32Ptr(1), }, }, expected: false, }, { msg: "both probe ports and names match should return true", existingProbe: []network.Probe{ { Name: to.StringPtr("matchName"), ProbePropertiesFormat: &network.ProbePropertiesFormat{ Port: to.Int32Ptr(1), }, }, }, curProbe: network.Probe{ Name: to.StringPtr("matchName"), ProbePropertiesFormat: &network.ProbePropertiesFormat{ Port: to.Int32Ptr(1), }, }, expected: true, }, } for i, test := range tests { findResult := findProbe(test.existingProbe, test.curProbe) assert.Equal(t, test.expected, findResult, fmt.Sprintf("TestCase[%d]: %s", i, test.msg)) } } </ins>