Detaching a target group from a network load balancer
To detach a target group from a network load balancer:
- In the management console
, select the folder in which to detach a target group from a load balancer. - In the list of services, select Network Load Balancer.
- Select the load balancer to detach a target group from.
- Under Target groups, click
in the line of the appropriate target group. - In the menu that opens, click Detach.
- In the window that opens, click Detach.
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
-
View a description of the CLI command to detach a target group from a network load balancer:
yc load-balancer network-load-balancer detach-target-group --help
-
Detach a target group from a network load balancer:
yc load-balancer network-load-balancer detach-target-group <load_balancer_name_or_ID> \ --target-group-id=<target_group_ID>
You can get the load balancer ID and name, as well as the IDs of the attached target groups, with a list of network load balancers in the folder.
Terraform
For more information about the provider resources, see the documentation on the Terraform
If you change the configuration files, Terraform automatically detects which part of your configuration is already deployed, and what should be added or removed.
If you don't have Terraform, install it and configure the Yandex Cloud provider.
To detach a target group from a network load balancer created with Terraform:
-
Open the Terraform configuration file and delete the fragment with the target group description.
resource "yandex_lb_network_load_balancer" "foo" { name = "<network_load_balancer_name>" ... attached_target_group { target_group_id = "<target_group_ID>" healthcheck { name = "<health_check_name>" http_options { port = <port_number> path = "<URL>" } } } ... }
-
Make sure the settings are correct.
-
Using the command line, navigate to the folder that contains the up-to-date Terraform configuration files with an infrastructure plan.
-
Run the command:
terraform validate
If there are errors in the configuration files, Terraform will point to them.
-
-
Delete the network load balancer.
-
Run the command to view planned changes:
terraform plan
If the resource configuration descriptions are correct, the terminal will display a list of the resources to modify and their parameters. This is a test step. No resources are updated.
-
If you are happy with the planned changes, apply them:
-
Run the command:
terraform apply
-
Confirm the update of resources.
-
Wait for the operation to complete.
-
-
To detach a target group from a network load balancer, use the detachTargetGroup REST API method for the NetworkLoadBalancer resource or the NetworkLoadBalancerService/DetachTargetGroup gRPC API call and provide the following in the request:
- Load balancer ID in the
networkLoadBalancerId
parameter. - Target group ID in the
targetGroupId
parameter.
You can get the IDs of the load balancer and attached target groups with a list of network load balancers in the folder.