[[["易于理解","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\u003e\u003ccode\u003eStatefulSet\u003c/code\u003e objects can be updated using either the \u003ccode\u003eOnDelete\u003c/code\u003e or \u003ccode\u003eRollingUpdate\u003c/code\u003e strategies, with \u003ccode\u003eRollingUpdate\u003c/code\u003e being the default method that automatically recreates \u003ccode\u003ePod\u003c/code\u003e objects upon configuration changes, ensuring the new \u003ccode\u003ePod\u003c/code\u003es are running and ready before deleting the old ones.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eStatefulSet\u003c/code\u003e objects use a sequential ordinal index for identifying and ordering their \u003ccode\u003ePod\u003c/code\u003e objects, where by default, pods are deployed sequentially and terminated in reverse order, ensuring a controlled update process.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ekubectl apply\u003c/code\u003e command is a common declarative way to update a \u003ccode\u003eStatefulSet\u003c/code\u003e by applying a new or updated manifest file, and can also create the resource if it doesn't already exist.\u003c/p\u003e\n"],["\u003cp\u003eYou can monitor the update rollout of a \u003ccode\u003eStatefulSet\u003c/code\u003e by using \u003ccode\u003ekubectl rollout status\u003c/code\u003e and \u003ccode\u003ekubectl rollout history\u003c/code\u003e commands, allowing for detailed inspection of the process, and the ability to undo the rollout with \u003ccode\u003ekubectl rollout undo\u003c/code\u003e if necessary.\u003c/p\u003e\n"],["\u003cp\u003eBy setting \u003ccode\u003epodManagementPolicy: Parallel\u003c/code\u003e, you can have a \u003ccode\u003eStatefulSet\u003c/code\u003e launch and terminate all of its \u003ccode\u003ePod\u003c/code\u003e objects simultaneously, rather than sequentially.\u003c/p\u003e\n"]]],[],null,["# Update stateful workloads\n\nThis page explains how to update existing stateful 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. For more information on planning updates for stateful workloads, see\nthe Kubernetes documentation for\n[Update strategies](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#update-strategies).\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 stateful workloads, ask your\nOrganization IAM Admin to grant you the Namespace Admin role (`namespace-admin`)\nin your project namespace.\n\nUpdate a `StatefulSet` resource\n-------------------------------\n\nTo update the `StatefulSet`, apply a new or updated manifest file. This is\nuseful for making various changes to your `StatefulSet` when scaling or for\nspecifying a new version of your application.\n\nTo update a `StatefulSet` 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\"\u003eSTATEFULSET_FILE\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eCLUSTER_KUBECONFIG\u003c/var\u003e: the kubeconfig file for\n the Kubernetes cluster running the stateful workloads.\n\n- \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e: the project namespace.\n\n- \u003cvar translate=\"no\"\u003eSTATEFULSET_FILE\u003c/var\u003e: the name of the updated\n `StatefulSet` manifest file.\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\nInspect a `StatefulSet` resource update rollout\n-----------------------------------------------\n\nYou can view detailed information regarding the update rollout status and\nhistory of a `StatefulSet` object. You can also undo a rollout of a\n`StatefulSet` object.\n\n### Inspect the rollout\n\nTo inspect the rollout of the `StatefulSet` resource, run: \n\n kubectl --kubeconfig \u003cvar translate=\"no\"\u003eCLUSTER_KUBECONFIG\u003c/var\u003e -n \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e \\\n rollout status statefulset \u003cvar translate=\"no\"\u003eSTATEFULSET_NAME\u003c/var\u003e\n\n- \u003cvar translate=\"no\"\u003eCLUSTER_KUBECONFIG\u003c/var\u003e: the kubeconfig file for\n the Kubernetes cluster running the stateful workloads.\n\n- \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e: the project namespace.\n\n- \u003cvar translate=\"no\"\u003eSTATEFULSET_NAME\u003c/var\u003e: the name of the updated\n `StatefulSet` object.\n\n### Get the rollout history\n\nTo see the `StatefulSet` resource's rollout history, run: \n\n kubectl --kubeconfig \u003cvar translate=\"no\"\u003eCLUSTER_KUBECONFIG\u003c/var\u003e -n \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e \\\n rollout history statefulset \u003cvar translate=\"no\"\u003eSTATEFULSET_NAME\u003c/var\u003e\n\n- \u003cvar translate=\"no\"\u003eCLUSTER_KUBECONFIG\u003c/var\u003e: the kubeconfig file for\n the Kubernetes cluster running the stateful workloads.\n\n- \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e: the project namespace.\n\n- \u003cvar translate=\"no\"\u003eSTATEFULSET_NAME\u003c/var\u003e: the name of the updated\n `StatefulSet` object.\n\n### Undo a rollout\n\nTo undo a rollout, run: \n\n kubectl --kubeconfig \u003cvar translate=\"no\"\u003eCLUSTER_KUBECONFIG\u003c/var\u003e -n \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e \\\n rollout undo statefulset \u003cvar translate=\"no\"\u003eSTATEFULSET_NAME\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eCLUSTER_KUBECONFIG\u003c/var\u003e: the kubeconfig file for\n the Kubernetes cluster running the stateful workloads.\n\n- \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e: the project namespace.\n\n- \u003cvar translate=\"no\"\u003eSTATEFULSET_NAME\u003c/var\u003e: the name of the `StatefulSet`\n object."]]