question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve experience adding/removing VMs/NICs to/from load balancers

See original GitHub issue

Couple of suggestions for improving the experience when working with load balancers. Or set me straight if I’m just doing it all wrong 😃

To add or remove a VM from the load balancer, you actually work with a virtual NIC resource. Logically, and architecturally, this makes sense. But really, it’s the VM you’re working on.

az vm create allows you to specify --nsg or --subnet to hook a VM up to existing network resources. Adding the option for --lb-name and --lb-backend-pools would be awesome. Or am I missing how to create a VM, let a new virtual NIC be created, and add it to a load balancer? Now it seems like you have to create the NIC with:

az network nic create \
  --resource-group myResourceGroup \
  --name myNic \
  --vnet-name myVnet \
  --subnet mySubnet \
  --network-security-group myNetworkSecurityGroup \
  --lb-name myLoadBalancer \
  --lb-address-pools myBackEndPool

And then create the VM with az vm create --nics myNic [...]

Kind of along the same lines, adding or removing a VM from a load balancer means working with the virtual NIC resource. Cool, a VM could have more than virtual NIC, but then it seems like I have to obtain the ID for a virtual NIC, strip to get just the name, and then remove or add from the load balancer. I can get the ID for a virtual NIC from a VM, but az network nic ip-config address-pool remove or address-pool add wants a NIC name, not ID. So I end up with:

vmnic=$(az vm show --resource-group myResourceGroup --name myVM \
    --query [networkProfile.networkInterfaces[*].id] --output tsv | sed 's:.*/::')

az network nic ip-config address-pool remove \
    --resource-group myResourceGroup \
    --nic-name $vmnic \
    --ip-config-name ipConfig1 \
    --lb-name myLoadBalancer \
    --address-pool myBackEndPool 

Or again, am I missing an easier way here?

Suggestion would be to either

  • allow az network nic ip-config add | remove to accept something like --nic-id rather than --nic-name, or
  • allow for --vm-name and then take the first virtual NIC attached to the VM.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
tjprescottcommented, Mar 22, 2017

Hi @iainfoulds the help text for nic ip-config backend-address add:

Resource Id Arguments
    --ids                    : One or more resource IDs (space delimited). If provided, no other
                               'Resource Id' arguments should be specified.
    --ip-config-name -n      : The name of the IP configuration.
    --nic-name               : The network interface (NIC).
    --resource-group -g      : Name of resource group. You can configure the default group using 'az
                               configure --defaults group=<name>'.

So you can either specify --nic-name + --resource-group + --ip-config-name OR --ids, which should accept the ID of the nic IP config.

0reactions
tjprescottcommented, Oct 1, 2018

Due to the perceived amount of engineering effort needed to simplify these scenarios balanced against the lack of customer asks in this area, we have decided to not pursue these changes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configure NIC Teaming, Failover, and Load Balancing on ...
Procedure · On the vSphere Client Home page, click Networking and navigate to the distributed switch. · Navigate the Teaming and Failover policy ......
Read more >
Add network interfaces to or remove from Azure VMs
Go to the Azure portal to find an existing virtual machine. · Select the name of the VM for which you want to...
Read more >
Set up Internal HTTP(S) Load Balancing with VM instance ...
This document provides instructions for configuring Internal HTTP(S) Load Balancing for your services that run on Compute Engine VMs.
Read more >
What is NIC Teaming, and How Does It Increase Uptime?
The major benefits of NIC teaming are load balancing (redistributing traffic over networks) and failover (ensuring network continuity in the ...
Read more >
Scenarios for network interfaces
0.0/0 , or from the load balancer). The private facing interface has an associated security group allowing SSH access only from an allowed...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found