Inspect stateful workloads

After you create a StatefulSet object, you can request information about it and its managed resources.

Before you begin

To run commands against a user cluster, use the gdcloud CLI to access its kubeconfig file.

  1. Ensure that you have downloaded, installed, and configured the gdcloud CLI.

  2. Run gdcloud auth login to log in to the org admin cluster.

  3. Locate the user cluster name, or ask your Platform Administrator what the cluster name is.

  4. To generate the kubeconfig file of the user cluster, run:

    gdcloud clusters get-credentials USER_CLUSTER_NAME
    
  5. Record the path to the generated file, such as /tmp/user-cluster-kubeconfig-with-user-identity.yaml.

  6. Use the path to replace USER_CLUSTER_KUBECONFIG in these instructions.

To get the required permissions to inspect stateful workloads, ask your Organization IAM Admin to grant you the Namespace Admin role.

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 USER_CLUSTER_KUBECONFIG \
    describe statefulset STATEFULSET_NAME

Replace the following:

  • USER_CLUSTER_KUBECONFIG: the kubeconfig file for the user cluster running the StatefulSet object.

  • STATEFULSET_NAME: the name of the StatefulSet object.

Display live configuration in YAML format

To display the live configuration of the StatefulSet resource in YAML format, run:

kubectl --kubeconfig USER_CLUSTER_KUBECONFIG \
    get statefulset STATEFULSET_NAME -o yaml

Replace the following:

  • USER_CLUSTER_KUBECONFIG: the kubeconfig file for the user cluster running the StatefulSet object.

  • STATEFULSET_NAME: the name of the StatefulSet object.

List pods

To list the Pod objects created by the StatefulSet, run:

kubectl --kubeconfig USER_CLUSTER_KUBECONFIG \
    get pods -l app=APP_NAME

In this command, the -l flag lists all Pod objects labeled with APP_NAME.

Replace the following:

  • USER_CLUSTER_KUBECONFIG: the kubeconfig file for the user cluster running the StatefulSet object.

  • APP_NAME: the name of the stateful application managed by the StatefulSet object.

Get specific pod information

To get information about a specific Pod in the user cluster, run:

kubectl --kubeconfig USER_CLUSTER_KUBECONFIG \
    describe pod POD_NAME

Replace the following:

  • USER_CLUSTER_KUBECONFIG: the kubeconfig file for the user cluster running the pod.

  • POD_NAME: the name of the pod managed by the StatefulSet object.

List PVCs

To list the PersistentVolumeClaim (PVC) objects in the user cluster, run:

kubectl --kubeconfig USER_CLUSTER_KUBECONFIG get pvc

Replace USER_CLUSTER_KUBECONFIG with the kubeconfig file of the user cluster running the PVCs.

Get specific PVC information

To get information about a specific PersistentVolumeClaim (PVC) in the user cluster, run:

kubectl --kubeconfig USER_CLUSTER_KUBECONFIG \
    describe pvc PVC_NAME

Replace the following:

  • USER_CLUSTER_KUBECONFIG: the kubeconfig file for the user cluster running the PVC.

  • PVC_NAME: the name of the PVC configured for the StatefulSet object.

Get PV information

To get information about a specific PersistentVolume (PV) in the user cluster, run:

kubectl --kubeconfig USER_CLUSTER_KUBECONFIG \
    describe pv PV_NAME

Replace the following:

  • USER_CLUSTER_KUBECONFIG: the kubeconfig file for the user cluster running the PV.

  • PV_NAME: the name of the PV configured for the StatefulSet object.