ACS icon indicating copy to clipboard operation
ACS copied to clipboard

Kubernetes - Azure Load Balancer provisioning fails - name too long

Open marceldempers opened this issue 7 years ago • 6 comments

Reporting of bug

Is this an ISSUE or FEATURE REQUEST? (choose one):

ISSUE:

Orchestrator and version (e.g. Kubernetes, DC/OS, Swarm)

ACS with Kubernetes deployed with Azure CLI 2.0: Server Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.6", GitCommit:"7fa1c1756d8bc963f1a389f4a6937dc71f08ada2", GitTreeState:"clean", BuildDate:"2017-06-16T18:21:54Z", GoVersion:"go1.7.6", Compiler:"gc", Platform:"linux/amd64"}

What happened:

I've provisioned an ACS cluster with Kubernetes. When deploying a Pod with Service, I noticed that kube-controller-manager on master cannot provision Azure Load Balancer for the Service I deployed with type: LoadBalancer If I do kubectl get services I see my service external endpoint remaining in <PENDING> state.

Having a closer look at kube-controller-manager logs, it looks like its reaching the Load Balancer naming character limit of 80.

Looks like a concatenation of resource group, ACS name and container name etc which results in a name that is too long for the load balancer ?

Logs from kube-controller-manager: Ensuring LB for service default/bookingservice 2017-06-20T23:34:19.947310936Z E0620 23:34:19.946844 1 servicecontroller.go:779] Failed to process service. Retrying in 5m0s: Failed to create load balancer for service default/bookingservice: network.PublicIPAddressesClient#CreateOrUpdate: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="InvalidResourceName" Message="Resource name k8-test-demo-container-services-k8-training-9e1abf-ad8dc07c8558211e7a59f000d3ad0b58 is invalid. The name can be up to 80 characters long. It must begin with a word character, and it must end with a word character or with ''. The name may contain word characters or '.', '-', ''." Details=[]

What you expected to happen:

I expect my service to get an external IP by provisioning a load balancer when deploying a kubernetes service with type: LoadBalancer

How to reproduce it (as minimally and precisely as possible):

Deploy ACS with resource group name of 30 characters containing 1 or 2 "-" characters ACS name has 12 characters with "-" characters Example:

az acs create -g container-services-k8-training --name k8-test-demo --orchestrator-type kubernetes --generate-ssh-keys --service-principal $principal --client-secret $secret

Try deploy a service with type:LoadBalancer

echo "
kind: Service
apiVersion: v1
metadata:
  name: bookingservice
  namespace: default
spec:
  type: LoadBalancer
  selector:
    app: bookingservice
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
" | kubectl apply -f -

Anything else we need to know:

Apologies if this is known behaviour - I was unable to find an existing issue

Thanks, Marcel

marceldempers avatar Jun 21 '17 01:06 marceldempers

@jdumars as per our discussion https://kubernetes.slack.com/archives/C5HJXTT9Q/p1499199490084628

amritb avatar Jul 04 '17 20:07 amritb

@marceldempers Thanks for this detailed description, I have the same issue.

The name seems to be generated the following way: [container service]-[resource group]-[random 6]-[random 32] That means we have 39 characters for the container service and resource group names together.

Is there any chance to influence how the load balancer name is generated or do we have to recreate all our resource groups and container services as a workaround?

Renaming the resource is not possible: https://feedback.azure.com/forums/281804-azure-resource-manager/suggestions/6017710-rename-resource-groups

davenmth avatar Jul 20 '17 12:07 davenmth

I can confirm this is a bug. I've reproduced it and worked around it by using a shorter service and resource group name (which involves redeploying the cluster).

SorraTheOrc avatar Jul 24 '17 20:07 SorraTheOrc

Yep, same thing here. Re-creating everything...

jorgearteiro avatar Jul 31 '17 04:07 jorgearteiro

same here: Warning CreatingLoadBalancerFailed 3m (x36 over 2h) service-controller
Error creating load balancer (will retry): Failed to create load balancer for service kube-system/kibana-logging: network.PublicIPAddressesClient#CreateOrUpdate: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="InvalidResourceName" Message="Resource name xxx-managed-lod-northeurope-lhsn4dewd34mgmt-aa8d2afbb2cf111e899a9000d3aba07f is invalid. The name can be up to 80 characters long. It must begin with a word character, and it must end with a word character or with ''. The name may contain word characters or '.', '-', ''." Details=[] xxx-managed-lod-northeurope-lhsn4dewd34mgmt-aa8d2afbb2cf111e899a9000d3aba07f

lironmo avatar Mar 21 '18 13:03 lironmo

Using Pivotal Container Service (PKS) on Azure & ran into this

Resource name a6e3b5380eaca11e9ac9f000d3a42ae6-sandbox-centralus-xxxxxxxx-infrastructure-subnet is invalid. The name can be up to 80 characters long. It must begin with a word character, and it must end with a word character or with ''. The name may contain word characters or '.', '-', ''.

In my case the generated resource name is 81 characters long.

;_;

aegershman avatar Oct 09 '19 20:10 aegershman