Stay organized with collections
Save and categorize content based on your preferences.
Learn how to set the time within which a response for a request must be returned
by your Knative serving services. If a response isn't returned within the
time specified, the request ends and error 504 is returned.
Timeout limits
The maximum timeout limit differs based on the version of your
GKE cluster.
GKE version
Default limit
Maximum timeout limit
0.16.0-gke.1 and later
300 seconds
24 hours
0.15.0-gke.3 and earlier
300 seconds
900 seconds
In addition to changing the Knative serving request timeout, you
should check your language framework to see whether it has its own request
timeout setting that you must also update.
Setting and updating request timeout
Any configuration change leads to the
creation of a new revision. Subsequent revisions will also automatically get
this configuration setting unless you make explicit updates to change it.
You can set request timeout using the Google Cloud console,
the Google Cloud CLI, or a YAML file when you deploy a new
service or update an existing service and
deploy a revision:
Console
Go to Knative serving in the Google Cloud console:
Click Create Service if you are configuring a
new service you are deploying to. If you are configuring an
existing service, click on the service, then click
Edit & Deploy New Revision.
Under Advanced settings, click Container.
In the Request timeout field, enter the
timeout value that you want to use. The value you specify must be less than the
timeout limit for the cluster's GKE
version.
Click Next to continue to the next section.
In the Configure how this service is triggered section,
select which connectivity you would like to use to invoke the service.
Click Create to deploy the image to Knative serving and wait
for the deployment to finish.
Command line
For existing services, set the request timeout by
running the gcloud run services update command with the
--timeout
parameter:
gcloudrunservicesupdateSERVICE--timeoutTIMEOUT
Replace:
SERVICE with the name of your service.
TIMEOUT with the desired time, using an integer
value in seconds, or an
absolute duration value,
for example 1m20s which is 1 minute, 20 seconds. The value you
specify must be less than the
timeout limit for the cluster's GKE version.
Specify 0 to set the timeout to the default value.
For new services, set the request timeout by running
the gcloud run deploy command with the
--timeout
parameter:
IMAGE_URL with a reference to the container image, for
example, gcr.io/myproject/my-image:latest.
TIMEOUT with the desired time, using an integer
value in seconds, or an
absolute duration value,
for example 1m20s which is 1 minute, 20 seconds. The value you
specify must be less than the
timeout limit for the cluster's GKE version.
Specify 0 to set the timeout to the default value.
YAML
You can download the configuration of an existing service into a
YAML file with the gcloud run services describe command by using the
--format=export flag.
You can then modify that YAML file and deploy
those changes with the gcloud beta run services replace command.
You must ensure that you modify only the specified attributes.
Download the configuration of your service into a file named
service.yaml on local workspace:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-25 UTC."],[[["\u003cp\u003eKnative serving allows you to set a timeout for requests, after which an error 504 is returned if no response is received.\u003c/p\u003e\n"],["\u003cp\u003eThe maximum timeout limit varies depending on the GKE cluster version, with a default of 300 seconds and maximums of 24 hours for version 0.16.0-gke.1 and later, and 900 seconds for version 0.15.0-gke.3 and earlier.\u003c/p\u003e\n"],["\u003cp\u003eRequest timeouts can be configured via the Google Cloud console, the Google Cloud CLI using \u003ccode\u003egcloud run services update\u003c/code\u003e or \u003ccode\u003egcloud run deploy\u003c/code\u003e, or by modifying and deploying a YAML file, with each method resulting in the creation of a new revision.\u003c/p\u003e\n"],["\u003cp\u003eWhen using the command line, you can specify timeout using an integer value in seconds, or an absolute duration value and must be less than the timeout limit for your cluster version.\u003c/p\u003e\n"],["\u003cp\u003eIt is important to check and update any request timeout settings within your language framework in addition to the Knative setting.\u003c/p\u003e\n"]]],[],null,["# Setting request timeout\n\nLearn how to set the time within which a response for a request must be returned\nby your Knative serving services. If a response isn't returned within the\ntime specified, the request ends and error `504` is returned.\n\nTimeout limits\n--------------\n\nThe maximum timeout limit differs based on the version of your\n[GKE cluster](/anthos/run/archive/docs/cluster-versions).\n\nIn addition to changing the Knative serving request timeout, you\nshould check your language framework to see whether it has its own request\ntimeout setting that you must also update.\n\nSetting and updating request timeout\n------------------------------------\n\nAny configuration change leads to the\ncreation of a new revision. Subsequent revisions will also automatically get\nthis configuration setting unless you make explicit updates to change it.\n\nYou can set request timeout using the Google Cloud console,\nthe Google Cloud CLI, or a YAML file when you deploy a new\n[service](/anthos/run/archive/docs/deploying#service) or update an existing service and\ndeploy a [revision](/anthos/run/archive/docs/deploying#revision): \n\n### Console\n\n\n1. Go to Knative serving in the Google Cloud console:\n\n [Go to Knative serving](https://console.cloud.google.com/kubernetes/run)\n2. Click **Create Service** if you are configuring a\n new service you are deploying to. If you are configuring an\n existing service, click on the service, then click\n **Edit \\& Deploy New Revision**.\n\n3. Under *Advanced settings* , click **Container**.\n\n4. In the **Request timeout** field, enter the\n timeout value that you want to use. The value you specify must be less than the\n [timeout limit](#limit) for the cluster's GKE\n version.\n\n5. Click **Next** to continue to the next section.\n\n6. In the **Configure how this service is triggered** section,\n select which connectivity you would like to use to invoke the service.\n\n7. Click **Create** to deploy the image to Knative serving and wait\n for the deployment to finish.\n\n### Command line\n\n- For existing services, set the request timeout by\n running the `gcloud run services update` command with the\n [`--timeout`](/sdk/gcloud/reference/run/services/update#--timeout)\n parameter:\n\n ```bash\n gcloud run services update SERVICE --timeout TIMEOUT\n ```\n\n Replace:\n - \u003cvar translate=\"no\"\u003eSERVICE\u003c/var\u003e with the name of your service.\n - \u003cvar translate=\"no\"\u003eTIMEOUT\u003c/var\u003e with the desired time, using an integer value in seconds, or an [absolute duration value](/sdk/gcloud/reference/topic/datetimes), for example `1m20s` which is 1 minute, 20 seconds. The value you specify must be less than the [timeout limit](#limit) for the cluster's GKE version. Specify `0` to set the timeout to the [default value](#limit).\n- For new services, set the request timeout by running\n the `gcloud run deploy` command with the\n [`--timeout`](/sdk/gcloud/reference/run/deploy#--timeout)\n parameter:\n\n ```bash\n gcloud run deploy SERVICE --image=IMAGE_URL --timeout TIMEOUT\n ```\n\n Replace:\n - \u003cvar translate=\"no\"\u003eSERVICE\u003c/var\u003e with the name of your service.\n - \u003cvar translate=\"no\"\u003eIMAGE_URL\u003c/var\u003e with a reference to the container image, for example, `gcr.io/myproject/my-image:latest`.\n - \u003cvar translate=\"no\"\u003eTIMEOUT\u003c/var\u003e with the desired time, using an integer value in seconds, or an [absolute duration value](/sdk/gcloud/reference/topic/datetimes), for example `1m20s` which is 1 minute, 20 seconds. The value you specify must be less than the [timeout limit](#limit) for the cluster's GKE version. Specify `0` to set the timeout to the [default value](#limit).\n\n### YAML\n\n| **Caution:** Deploying configuration changes using YAML files replaces the configuration of your existing services. Since a YAML file completely overwrites all configurations, you should avoid using multiple methods to modify your services. For example, do not use YAML files in conjunction with the Google Cloud console or `gcloud` commands.\n\nYou can download the configuration of an existing service into a\nYAML file with the `gcloud run services describe` command by using the\n[`--format=export`](/sdk/gcloud/reference/run/services/describe) flag.\nYou can then modify that YAML file and deploy\nthose changes with the `gcloud beta run services replace` command.\nYou must ensure that you modify only the specified attributes.\n\n1. Download the configuration of your service into a file named\n `service.yaml` on local workspace:\n\n ```bash\n gcloud run services describe SERVICE --format export \u003e service.yaml\n ```\n\n Replace \u003cvar translate=\"no\"\u003eSERVICE\u003c/var\u003e with the name of your\n Knative serving service.\n2. In your local file, update the `timeoutSeconds` attribute:\n\n ```yaml\n apiVersion: serving.knative.dev/v1\n kind: Service\n metadata:\n name: SERVICE\n spec:\n template:\n spec:\n containers:\n - image: IMAGE\n timeoutSeconds: TIMEOUT\n ```\n\n Replace:\n - \u003cvar translate=\"no\"\u003eSERVICE\u003c/var\u003e with the name of your Knative serving service\n - \u003cvar translate=\"no\"\u003eIMAGE_URL\u003c/var\u003e with a reference to the container image, for example, `gcr.io/myproject/my-image:latest`.\n - \u003cvar translate=\"no\"\u003eTIMEOUT\u003c/var\u003e with the desired timeout, in seconds.\n3. Replace the service with its new configuration using the following command:\n\n ```bash\n gcloud beta run services replace service.yaml\n ```"]]