This page explains how to update existing stateful workloads running in a Google Distributed Cloud (GDC) air-gapped Kubernetes cluster. As your application evolves based on resource usage and configuration optimizations, you must update your underlying pod specification in the Kubernetes cluster to reflect those workload changes. For more information on planning updates for stateful workloads, see the Kubernetes documentation for Update strategies.
This page is for developers within the application operator group, who are responsible for updating application workloads for their organization. For more information, see Audiences for GDC air-gapped documentation.
Before you begin
To run commands against a Kubernetes cluster, make sure you have the following resources:
Locate the Kubernetes cluster name, or ask your Platform Administrator what the cluster name is.
Sign in and generate the kubeconfig file for the Kubernetes cluster if you don't have one.
Use the kubeconfig path of the Kubernetes cluster to replace
KUBERNETES_CLUSTER_KUBECONFIG
in these instructions.
To get the required permissions to update stateful workloads, ask your
Organization IAM Admin to grant you the Namespace Admin role (namespace-admin
)
in your project namespace.
Update a StatefulSet
resource
To update the StatefulSet
, apply a new or updated manifest file. This is
useful for making various changes to your StatefulSet
when scaling or for
specifying a new version of your application.
To update a StatefulSet
object, run:
kubectl --kubeconfig KUBERNETES_CLUSTER_KUBECONFIG -n NAMESPACE \
apply -f STATEFULSET_FILE
Replace the following:
KUBERNETES_CLUSTER_KUBECONFIG
: the kubeconfig file for the cluster running the stateful workloads.NAMESPACE
: the project namespace.STATEFULSET_FILE
: the name of the updatedStatefulSet
manifest file.
The kubectl apply
command applies a manifest file to a resource. If the
specified resource does not exist, it is created by the command.
Inspect a StatefulSet
resource update rollout
You can view detailed information regarding the update rollout status and
history of a StatefulSet
object. You can also undo a rollout of a
StatefulSet
object.
Inspect the rollout
To inspect the rollout of the StatefulSet
resource, run:
kubectl --kubeconfig KUBERNETES_CLUSTER_KUBECONFIG -n NAMESPACE \
rollout status statefulset STATEFULSET_NAME
KUBERNETES_CLUSTER_KUBECONFIG
: the kubeconfig file for the cluster running the stateful workloads.NAMESPACE
: the project namespace.STATEFULSET_NAME
: the name of the updatedStatefulSet
object.
Get the rollout history
To see the StatefulSet
resource's rollout history, run:
kubectl --kubeconfig KUBERNETES_CLUSTER_KUBECONFIG -n NAMESPACE \
rollout history statefulset STATEFULSET_NAME
KUBERNETES_CLUSTER_KUBECONFIG
: the kubeconfig file for the cluster running the stateful workloads.NAMESPACE
: the project namespace.STATEFULSET_NAME
: the name of the updatedStatefulSet
object.
Undo a rollout
To undo a rollout, run:
kubectl --kubeconfig KUBERNETES_CLUSTER_KUBECONFIG -n NAMESPACE \
rollout undo statefulset STATEFULSET_NAME
Replace the following:
KUBERNETES_CLUSTER_KUBECONFIG
: the kubeconfig file for the cluster running the stateful workloads.NAMESPACE
: the project namespace.STATEFULSET_NAME
: the name of theStatefulSet
object.