This document explains how to inspect existing stateful workloads running in a Google Distributed Cloud (GDC) air-gapped Kubernetes cluster. Stateful workloads let you run your application with persistent container storage. You can view your stateful workloads with the GDC console or the kubectl CLI to monitor resource usage and workload health.
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 complete the tasks in this document, you must have the following resources and roles:
To run commands against a Kubernetes cluster, make sure you have the following resources:
Locate the Kubernetes cluster name, or ask a member of the platform administrator group 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 view all workloads deployed to a shared cluster, ask your Organization IAM Admin to grant you the Workload Viewer role (
workload-viewer) in your project namespace.To get the required permissions to inspect stateful workloads in a shared cluster, ask your Organization IAM Admin to grant you the Namespace Admin role (
namespace-admin) in your project namespace.To get the required permissions to view and inspect stateful workloads in a standard cluster, ask your Organization IAM Admin to grant you the Cluster Developer role (
cluster-developer) in a standard cluster.
View a project's container workloads
To view your project's container workloads, complete the following:
Console
In the navigation menu, select Kubernetes Engine > Workloads.
You can view details for your container workloads, such as the following:
- Name
- Type
- Number of pods
- Kubernetes cluster
- Last modified date
The container workloads are organized by which Kubernetes cluster they belong to. Select the Cluster drop-down to switch the cluster context.
CLI
Run the following command to list all pods in your project:
kubectl get pods -n PROJECT_NAMESPACEThe output is similar to the following:
NAME READY STATUS RESTARTS AGE nginx-workload-ah-aa-1228 1/1 Running 0 12h nginx-workload-ah-ab-6784 1/1 Running 0 11h nginx-workload-ah-ac-0045 1/1 Running 0 12h
Inspect a StatefulSet resource
To request more detailed information about the components of a StatefulSet
resource, run commands that directly target the entity you're looking to
inspect.
Get StatefulSet object information
To get detailed information about the StatefulSet object, run:
kubectl --kubeconfig KUBERNETES_CLUSTER_KUBECONFIG -n NAMESPACE \
describe statefulset STATEFULSET_NAME
Replace the following:
KUBERNETES_CLUSTER_KUBECONFIG: the kubeconfig file for the cluster running theStatefulSetobject.NAMESPACE: the namespace. For shared clusters, this must be a project namespace. For standard clusters, it can be any namespace.STATEFULSET_NAME: the name of theStatefulSetobject.
Display live configuration in YAML format
To display the live configuration of the StatefulSet resource in YAML format,
run:
kubectl --kubeconfig KUBERNETES_CLUSTER_KUBECONFIG -n NAMESPACE \
get statefulset STATEFULSET_NAME -o yaml
Replace the following:
KUBERNETES_CLUSTER_KUBECONFIG: the kubeconfig file for the cluster running theStatefulSetobject.NAMESPACE: the namespace. For shared clusters, this must be a project namespace. For standard clusters, it can be any namespace.STATEFULSET_NAME: the name of theStatefulSetobject.
List pods
To list the Pod objects created by the StatefulSet, run:
kubectl --kubeconfig KUBERNETES_CLUSTER_KUBECONFIG -n NAMESPACE \
get pods -l app=APP_NAME
In this command, the -l flag lists all Pod objects labeled with
APP_NAME.
Replace the following:
KUBERNETES_CLUSTER_KUBECONFIG: the kubeconfig file for the cluster running theStatefulSetobject.NAMESPACE: the namespace. For shared clusters, this must be a project namespace. For standard clusters, it can be any namespace.APP_NAME: the name of the stateful application managed by theStatefulSetobject.
Get specific pod information
To get information about a specific Pod in the cluster, run:
kubectl --kubeconfig KUBERNETES_CLUSTER_KUBECONFIG -n NAMESPACE \
describe pod POD_NAME
Replace the following:
KUBERNETES_CLUSTER_KUBECONFIG: the kubeconfig file for the cluster running the pod.NAMESPACE: the namespace. For shared clusters, this must be a project namespace. For standard clusters, it can be any namespace.POD_NAME: the name of the pod managed by theStatefulSetobject.
List PVCs
To list the PersistentVolumeClaim (PVC) objects in the cluster, run:
kubectl --kubeconfig KUBERNETES_CLUSTER_KUBECONFIG -n NAMESPACE \
get pvc
Replace the following:
KUBERNETES_CLUSTER_KUBECONFIG: the kubeconfig file of the cluster running the PVCs.NAMESPACE: the namespace. For shared clusters, this must be a project namespace. For standard clusters, it can be any namespace.
Get specific PVC information
To get information about a specific PersistentVolumeClaim (PVC) in the
cluster, run:
kubectl --kubeconfig KUBERNETES_CLUSTER_KUBECONFIG -n NAMESPACE \
describe pvc PVC_NAME
Replace the following:
KUBERNETES_CLUSTER_KUBECONFIG: the kubeconfig file for the cluster running the PVC.NAMESPACE: the namespace. For shared clusters, this must be a project namespace. For standard clusters, it can be any namespace.PVC_NAME: the name of the PVC configured for theStatefulSetobject.
Get PV information
To get information about a specific PersistentVolume (PV) in the cluster,
run:
kubectl --kubeconfig KUBERNETES_CLUSTER_KUBECONFIG -n NAMESPACE \
describe pv PV_NAME
Replace the following:
KUBERNETES_CLUSTER_KUBECONFIG: the kubeconfig file for the cluster running the PV.NAMESPACE: the namespace. For shared clusters, this must be a project namespace. For standard clusters, it can be any namespace.PV_NAME: the name of the PV configured for theStatefulSetobject.