I can create a Backen Service using the following commands:
# health check
gcloud compute http-health-checks create "$HEALTH_CHECK_NAME"
# backend service
gcloud compute backend-services create "$BACKEND_SERVICE_NAME" --http-health-check "$HEALTH_CHECK_NAME" --port-name "http" --timeout "30"
gcloud compute backend-services add-backend "$BACKEND_SERVICE_NAME" --instance-group "$GROUP_NAME" --balancing-mode "UTILIZATION" --capacity-scaler "1" --max-utilization "1"
But I have to add also the port the backend will get the requests. In the GCP Console, this configuration looks like this:
How can I set that port (or port numbers) using the gcloud
CLI?
I can not find any reference to ports in any of the help pages of the commands gcloud compute backend-services update-backend --help
and gcloud compute backend-services add-backend --help
You have two backend services: external-https-backend-service for an external HTTP(S) load balancer and internal-tcp-backend-service for an internal TCP/UDP load balancer. You're using an instance group called instance-group-a in internal-tcp-backend-service .
Load balancing refers to efficiently distributing incoming network traffic across a group of backend servers, also known as a server farm or server pool.
To create a backend service or snippet, aside from the code for the app's functionality that need to live on your server, you need to provide log in, configure, and manage capabilities at an external web site (if needed). Once you've created those sites and your app, follow the steps for developing an app.
The default timeout for Google HTTPS Load Balancers is 30 seconds for the backend to respond before considering it a failed request. For normal HTTP GET requests, 30 seconds should be plenty of time.
Ports are actually supplied at the instance-group level:
# Named Ports for Instance Group gcloud compute instance-groups managed set-named-ports "$GROUP_NAME" --named-ports "[NAME:PORT,...]" --zone "$ZONE"
In your case, your backend-service tries to look for the port with the name http. Also your desired port is 32656, thus the command would be:
gcloud compute instance-groups managed set-named-ports "$GROUP_NAME" --named-ports "http:32656" --zone "$ZONE"
You can easily choose the name of the port used by the backend-service via argument --port-name
of command gcloud compute backend-services create
.
See documentation: https://cloud.google.com/sdk/gcloud/reference/compute/backend-services/create
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With