I am running a cluster on GKE, and one particular http path needs a longer timeout than the load balancer's default 30 seconds. So I want to use a GKE BackendConfig object to extend the timeout, but I don't want to use it for all requests, just this particular path. Can I configure the Ingress to fan out to two NodePorts based on path, one with a BackendConfig with the longer timeout, and then the NodePorts would "fan in" to the same targetPort backend?
I think your can reach your design, following these steps:
1.- Defining 2 BackendConfig:
1.1 apiVersion: cloud.google.com/v1beta1 kind: BackendConfig metadata: name: custom-backend spec: timeoutSec: 40 connectionDraining: drainingTimeoutSec: 60
1.2 apiVersion: cloud.google.com/v1beta1 kind: BackendConfig metadata: name: default-backend spec: timeoutSec: 30 connectionDraining: drainingTimeoutSec: 60
2.- create two services:
2.1 One with the backend with a longer timeout (in this example, custom-backend)
apiVersion: v1 kind: Service metadata: name: custom-service labels: purpose: bsc-config-demo annotations: beta.cloud.google.com/backend-config: '{"ports": {"80":"custom-backend"}}' spec: type: NodePort selector: purpose: bsc-config-demo ports: - port: 80 protocol: TCP targetPort: 8080
2.2 Another with the default timeout.
apiVersion: v1 kind: Service metadata: name: default-service labels: purpose: bsc-config-demo annotations: beta.cloud.google.com/backend-config: '{"ports": {"80":"default-backend"}}' spec: type: NodePort selector: purpose: bsc-config-demo ports: - port: 80 protocol: TCP targetPort: 8080
apiVersion: extensions/v1beta1 kind: Ingress metadata: name: my-bsc-ingress spec: rules: - http: paths: - path: /* backend: serviceName: default-service servicePort: 80 - path: /folder/* backend: serviceName: custom-service servicePort: 80
A complete guide here:
Configuring a backend service through Ingress
Best Regards.