Set custom name in GKE loadbalancer

I had deployed a Google kubernetes cluster with 4 services 2 is angular app and 1 is node the deployment using ingress controller manifest and it automatically created a level 7 Loadbalancer with random name on frontend and backend on L7 Loadbalancer. I want my custom name to be applied on the Loadbalancer Here is the screenshot Kindly help me to set a custom dersired name for the Loadbalancer frontend and backend.

here is my ingress.yaml

I want to change the name of backend and health check name like angular and client

So kindly help me to achieve this.

3 Likes

Hi @Robinwilliam15 ,

If you want to have custom names for your backend and healthchecks, you’ll need to modify the configuration of the respective resources. Here’s how you can do it:

a. When deploying resources on GKE, such as Deployments or Services, you can set the metadata.name field to specify a custom name. For example, if you’re using a YAML configuration file for a Deployment, you can set the metadata.name field as follows:

apiVersion: apps/v1
kind: Deployment
metadata:
name: custom-backend-name
# ... rest of the configuration ...

Make sure to replace custom-backend-name with your desired custom name.

b. When you define liveness or readiness probes for your containers within a Deployment or Pod, you can similarly set the metadata.name field to customize the name of the probe. Here’s an example of how to set a custom name for a liveness probe:

apiVersion: v1
kind: Pod
metadata:
name: backend-pod
spec:
containers:
- name: backend-container
image: your-backend-image
# ... container configuration ...
livenessProbe:
httpGet:
path: /healthz
port: 8080
initialDelaySeconds: 3
periodSeconds: 10
name: custom-liveness-probe-name

Replace custom-liveness-probe-name with your desired name.

After updating your configuration files, you can apply them to your GKE cluster using the :
kubectl apply -f <filename> command.

1 Like