[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-04 (世界標準時間)。"],[[["\u003cp\u003eThis guide details how to retrieve information about \u003ccode\u003eStatefulSet\u003c/code\u003e objects and their associated resources within a Kubernetes cluster.\u003c/p\u003e\n"],["\u003cp\u003eYou can view a project's container workloads through the console or by using the \u003ccode\u003ekubectl get pods\u003c/code\u003e command.\u003c/p\u003e\n"],["\u003cp\u003eDetailed information about a \u003ccode\u003eStatefulSet\u003c/code\u003e can be obtained using \u003ccode\u003ekubectl describe statefulset\u003c/code\u003e, and its live configuration in YAML format using \u003ccode\u003ekubectl get statefulset -o yaml\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eYou can list the \u003ccode\u003ePod\u003c/code\u003e objects created by a \u003ccode\u003eStatefulSet\u003c/code\u003e using \u003ccode\u003ekubectl get pods\u003c/code\u003e and get information on a specific pod using \u003ccode\u003ekubectl describe pod\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eYou can list all \u003ccode\u003ePersistentVolumeClaim\u003c/code\u003e (PVC) objects using \u003ccode\u003ekubectl get pvc\u003c/code\u003e, or retrieve detailed information about a specific PVC or \u003ccode\u003ePersistentVolume\u003c/code\u003e (PV) using the \u003ccode\u003ekubectl describe\u003c/code\u003e command.\u003c/p\u003e\n"]]],[],null,["# Inspect stateful workloads\n\nThis page explains how to inspect existing stateful workloads running in a\nGoogle Distributed Cloud (GDC) air-gapped Kubernetes cluster. Stateful workloads let you\nrun your application with persistent container storage. You can view your\nstateful workloads with the GDC console or the kubectl CLI to monitor\nresource usage and workload health.\n\nThis page is for developers within the application operator group, who are\nresponsible for managing application workloads for their organization. For more\ninformation, see\n[Audiences for GDC air-gapped documentation](/distributed-cloud/hosted/docs/latest/gdch/resources/audiences).\n\nBefore you begin\n----------------\n\nTo run commands against a\n[Kubernetes cluster](/distributed-cloud/hosted/docs/latest/gdch/platform/pa-user/clusters#cluster-architecture),\nmake sure you have the following resources:\n\n1. Locate the Kubernetes cluster name, or ask your Platform Administrator what\n the cluster name is.\n\n2. [Sign in and generate](/distributed-cloud/hosted/docs/latest/gdch/application/ao-user/iam/sign-in#zonal-cluster-kubeconfig)\n the 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\"\u003eKUBERNETES_CLUSTER_KUBECONFIG\u003c/var\u003e in these instructions.\n\nTo get the required permissions to view all workloads deployed in a project, ask\nyour Organization IAM Admin to grant you the Workload Viewer role\n(`workload-viewer`) in your project namespace.\n\nTo get the required permissions to inspect stateful workloads, ask your\nOrganization IAM Admin to grant you the Namespace Admin role (`namespace-admin`)\nin your project namespace.\n\nView a project's container workloads\n------------------------------------\n\nTo view your project's container workloads, complete the following: \n\n### Console\n\n- In the navigation menu, select **Kubernetes Engine \\\u003e Workloads**.\n\n You can view details for your container workloads, such as the following:\n - Name\n - Type\n - Number of pods\n - Kubernetes cluster\n - Last modified date\n\n The container workloads are organized by which Kubernetes cluster they\n belong to. Select the **Cluster** drop-down to switch the cluster context.\n\n### CLI\n\n- Run the following command to list all pods in your project:\n\n kubectl get pods -n \u003cvar translate=\"no\"\u003ePROJECT_NAMESPACE\u003c/var\u003e\n\n The output is similar to the following: \n\n NAME READY STATUS RESTARTS AGE\n nginx-workload-ah-aa-1228 1/1 Running 0 12h\n nginx-workload-ah-ab-6784 1/1 Running 0 11h\n nginx-workload-ah-ac-0045 1/1 Running 0 12h\n\nInspect a `StatefulSet` resource\n--------------------------------\n\nTo request more detailed information about the components of a `StatefulSet`\nresource, run commands that directly target the entity you're looking to\ninspect.\n\n### Get `StatefulSet` object information\n\nTo get detailed information about the `StatefulSet` object, run: \n\n kubectl --kubeconfig \u003cvar translate=\"no\"\u003eKUBERNETES_CLUSTER_KUBECONFIG\u003c/var\u003e -n \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e \\\n describe statefulset \u003cvar translate=\"no\"\u003eSTATEFULSET_NAME\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eKUBERNETES_CLUSTER_KUBECONFIG\u003c/var\u003e: the kubeconfig file for\n the cluster running the `StatefulSet` object.\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.\n\n### Display live configuration in YAML format\n\nTo display the live configuration of the `StatefulSet` resource in YAML format,\nrun: \n\n kubectl --kubeconfig \u003cvar translate=\"no\"\u003eKUBERNETES_CLUSTER_KUBECONFIG\u003c/var\u003e -n \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e \\\n get statefulset \u003cvar translate=\"no\"\u003eSTATEFULSET_NAME\u003c/var\u003e -o yaml\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eKUBERNETES_CLUSTER_KUBECONFIG\u003c/var\u003e: the kubeconfig file for\n the cluster running the `StatefulSet` object.\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.\n\n### List pods\n\nTo list the `Pod` objects created by the `StatefulSet`, run: \n\n kubectl --kubeconfig \u003cvar translate=\"no\"\u003eKUBERNETES_CLUSTER_KUBECONFIG\u003c/var\u003e -n \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e \\\n get pods -l app=\u003cvar translate=\"no\"\u003eAPP_NAME\u003c/var\u003e\n\nIn this command, the `-l` flag lists all `Pod` objects labeled with\n\u003cvar translate=\"no\"\u003eAPP_NAME\u003c/var\u003e.\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eKUBERNETES_CLUSTER_KUBECONFIG\u003c/var\u003e: the kubeconfig file for\n the cluster running the `StatefulSet` object.\n\n- \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e: the project namespace.\n\n- \u003cvar translate=\"no\"\u003eAPP_NAME\u003c/var\u003e: the name of the stateful application\n managed by the `StatefulSet` object.\n\n### Get specific pod information\n\nTo get information about a specific `Pod` in the cluster, run: \n\n kubectl --kubeconfig \u003cvar translate=\"no\"\u003eKUBERNETES_CLUSTER_KUBECONFIG\u003c/var\u003e -n \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e \\\n describe pod \u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eKUBERNETES_CLUSTER_KUBECONFIG\u003c/var\u003e: the kubeconfig file for\n the cluster running the pod.\n\n- \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e: the project namespace.\n\n- \u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e: the name of the pod managed by the\n `StatefulSet` object.\n\n### List PVCs\n\nTo list the `PersistentVolumeClaim` (PVC) objects in the cluster, run: \n\n kubectl --kubeconfig \u003cvar translate=\"no\"\u003eKUBERNETES_CLUSTER_KUBECONFIG\u003c/var\u003e -n \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e \\\n get pvc\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eKUBERNETES_CLUSTER_KUBECONFIG\u003c/var\u003e: the kubeconfig file of\n the cluster running the PVCs.\n\n- \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e: the project namespace.\n\n### Get specific PVC information\n\nTo get information about a specific `PersistentVolumeClaim` (PVC) in the\ncluster, run: \n\n kubectl --kubeconfig \u003cvar translate=\"no\"\u003eKUBERNETES_CLUSTER_KUBECONFIG\u003c/var\u003e -n \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e \\\n describe pvc \u003cvar translate=\"no\"\u003ePVC_NAME\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eKUBERNETES_CLUSTER_KUBECONFIG\u003c/var\u003e: the kubeconfig file for\n the cluster running the PVC.\n\n- \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e: the project namespace.\n\n- \u003cvar translate=\"no\"\u003ePVC_NAME\u003c/var\u003e: the name of the PVC configured for the\n `StatefulSet` object.\n\n### Get PV information\n\nTo get information about a specific `PersistentVolume` (PV) in the cluster,\nrun: \n\n kubectl --kubeconfig \u003cvar translate=\"no\"\u003eKUBERNETES_CLUSTER_KUBECONFIG\u003c/var\u003e -n \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e \\\n describe pv \u003cvar translate=\"no\"\u003ePV_NAME\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eKUBERNETES_CLUSTER_KUBECONFIG\u003c/var\u003e: the kubeconfig file for\n the cluster running the PV.\n\n- \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e: the project namespace.\n\n- \u003cvar translate=\"no\"\u003ePV_NAME\u003c/var\u003e: the name of the PV configured for the\n `StatefulSet` object."]]