[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-04。"],[[["\u003cp\u003eUpdates to a \u003ccode\u003eDeployment\u003c/code\u003e object's pod specification, including image, resource usage, requests, or configuration, can be rolled out by applying a new or updated manifest file.\u003c/p\u003e\n"],["\u003cp\u003eTo update a \u003ccode\u003eDeployment\u003c/code\u003e object, you can use the \u003ccode\u003ekubectl apply\u003c/code\u003e command with the manifest file, or use the \u003ccode\u003ekubectl set image\u003c/code\u003e command to specifically change the container image, its tag, and other properties.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ekubectl\u003c/code\u003e CLI preserves the rollout history, allowing you to roll back an update to the previous revision or to a specific revision using the \u003ccode\u003ekubectl rollout undo deployment\u003c/code\u003e command.\u003c/p\u003e\n"],["\u003cp\u003eBefore updating, ensure you have the user cluster name, a kubeconfig file for that cluster, and the necessary permissions granted by your Organization IAM Admin, such as the Namespace Admin role.\u003c/p\u003e\n"]]],[],null,["# Update stateless workloads\n\nThis page explains how to update existing stateless workloads running in a\nGoogle Distributed Cloud (GDC) air-gapped appliance Kubernetes cluster. As your application evolves\nbased on resource usage and configuration optimizations, you must update your\nunderlying pod specification in the Kubernetes cluster to reflect those workload\nchanges.\n\nThis page is for developers within the application operator group, who are\nresponsible for updating application workloads for their organization.\n\nBefore you begin\n----------------\n\nTo run commands against the pre-configured bare metal Kubernetes cluster, make sure you have the\nfollowing resources:\n\n1. Locate the Kubernetes cluster name, or ask your Platform\n Administrator what the cluster name is.\n\n2. [Sign in and generate](/distributed-cloud/hosted/docs/latest/appliance/application/ao-user/iam/sign-in#kubernetes-cluster-kubeconfig) the\n kubeconfig file for the Kubernetes cluster if you don't have one.\n\n3. Use the kubeconfig path of the Kubernetes cluster to replace\n \u003cvar translate=\"no\"\u003eCLUSTER_KUBECONFIG\u003c/var\u003e in these instructions.\n\nTo get the required permissions to update stateless workloads, ask your\nOrganization IAM Admin to grant you the Namespace Admin role (`namespace-admin`)\nin your project namespace.\n\nUpdate the deployment\n---------------------\n\nTo update a `Deployment` object, run: \n\n kubectl --kubeconfig \u003cvar translate=\"no\"\u003eCLUSTER_KUBECONFIG\u003c/var\u003e -n \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e \\\n apply -f \u003cvar translate=\"no\"\u003eDEPLOYMENT_FILE\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eCLUSTER_KUBECONFIG\u003c/var\u003e: the kubeconfig file for the\n Kubernetes cluster running the deployment.\n\n- \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e: the project namespace.\n\n- \u003cvar translate=\"no\"\u003eDEPLOYMENT_FILE\u003c/var\u003e: the name of the `Deployment`\n manifest file to update.\n\nThe `kubectl apply` command applies a manifest file to a resource. If the\nspecified resource does not exist, it is created by the command.\n\nThere are also several other ways to update resources within your deployment.\n\n### Update a container image\n\nTo change the image of a `Deployment` object, run: \n\n kubectl --kubeconfig \u003cvar translate=\"no\"\u003eCLUSTER_KUBECONFIG\u003c/var\u003e -n \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e \\\n set image deployment \u003cvar translate=\"no\"\u003eDEPLOYMENT_NAME\u003c/var\u003e \\\n \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nv\"\u003eIMAGE\u003c/span\u003e\u003c/var\u003e=\u003cvar translate=\"no\"\u003eIMAGE\u003c/var\u003e:\u003cvar translate=\"no\"\u003eTAG\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eCLUSTER_KUBECONFIG\u003c/var\u003e: the kubeconfig file for the\n Kubernetes cluster running the deployment.\n\n- \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e: the project namespace.\n\n- \u003cvar translate=\"no\"\u003eDEPLOYMENT_NAME\u003c/var\u003e: the name of the `Deployment` object\n containing the image.\n\n- \u003cvar translate=\"no\"\u003eIMAGE\u003c/var\u003e: the name of the container image.\n\n- \u003cvar translate=\"no\"\u003eTAG\u003c/var\u003e: the tag to update for the container image.\n\nUpdating the image of a deployment is useful to change selector fields or\nresources, such as requests or limits.\n\nFor example, to update a `Deployment` object named `nginx` to use version\n`1.9.1`, run: \n\n kubectl --kubeconfig /tmp/kubeconfig.yaml -n my-namespace \\\n set image deployment nginx nginx=nginx:1.9.1\n\n### Roll back an update\n\nIf you want to roll back an update, such as when your deployment becomes\nunstable, use the `kubectl` CLI. A `Deployment` object's rollout history is\npreserved in the system so you can roll back at any time.\n\nTo roll back an in-progress or completed update to its previous revision,\nrun: \n\n kubectl --kubeconfig \u003cvar translate=\"no\"\u003eCLUSTER_KUBECONFIG\u003c/var\u003e \\\n -n \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e \\\n rollout undo deployment \u003cvar translate=\"no\"\u003eDEPLOYMENT_NAME\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eCLUSTER_KUBECONFIG\u003c/var\u003e: the kubeconfig file for the\n Kubernetes cluster running the deployment.\n\n- \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e: the project namespace.\n\n- \u003cvar translate=\"no\"\u003eDEPLOYMENT_NAME\u003c/var\u003e: the name of the `Deployment` object\n to roll back.\n\nTo roll back to a specific revision, run: \n\n kubectl --kubeconfig \u003cvar translate=\"no\"\u003eCLUSTER_KUBECONFIG\u003c/var\u003e \\\n -n \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e \\\n rollout undo deployment \u003cvar translate=\"no\"\u003eDEPLOYMENT_NAME\u003c/var\u003e \\\n --to-revision=\u003cvar translate=\"no\"\u003eREVISION_NUMBER\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eCLUSTER_KUBECONFIG\u003c/var\u003e: the kubeconfig file for the\n Kubernetes cluster running the deployment.\n\n- \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e: the project namespace.\n\n- \u003cvar translate=\"no\"\u003eDEPLOYMENT_NAME\u003c/var\u003e: the name of the `Deployment` object\n to roll back.\n\n- \u003cvar translate=\"no\"\u003eREVISION_NUMBER\u003c/var\u003e: the integer that defines the\n revision to roll back to, such as `3`."]]