This document describes how to scale existing stateful workloads running in a Google Distributed Cloud (GDC) air-gapped Kubernetes cluster. You must scale the pods running in your stateful workloads as your container workload requirements evolve.
This document is for developers within the application operator group who are responsible for managing 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_KUBECONFIGin these instructions.
To get the required permissions to scale stateful workloads, ask your
Organization IAM Admin to grant you the Namespace Admin role (namespace-admin)
in your project namespace.
Scale a StatefulSet resource
Leverage the scaling functionality of Kubernetes to appropriately scale the
amount of pods running in your StatefulSet resource.
Manually scale the pods of a StatefulSet resource
To manually scale your StatefulSet resource, run:
kubectl --kubeconfig KUBERNETES__CLUSTER_KUBECONFIG -n NAMESPACE \
scale statefulset STATEFULSET_NAME \
--replicas NUMBER_OF_REPLICAS
Replace the following:
KUBERNETES_CLUSTER_KUBECONFIG: the kubeconfig file for the cluster.NAMESPACE: the project namespace.STATEFULSET_NAME: the name of theStatefulSetobject in which to scale.NUMBER_OF_REPLICAS: the desired number of replicatedPodobjects in theStatefulSetobject.
Scale the pods by making an in-place update
To scale the pods of a StatefulSet resource directly in the manifest file,
run:
kubectl --kubeconfig KUBERNETES__CLUSTER_KUBECONFIG -n NAMESPACE \
patch statefulsets STATEFULSET_NAME \
-p '{"spec":{"replicas":NUMBER_OF_REPLICAS}}'
Replace the following:
KUBERNETES__CLUSTER_KUBECONFIG: the kubeconfig file for the cluster.NAMESPACE: the project namespace.STATEFULSET_NAME: the name of theStatefulSetobject in which to scale.NUMBER_OF_REPLICAS: the desired number of replicatedPodobjects in theStatefulSetobject.