# Kubernetes z-pages

> 为 Kubernetes 组件提供运行时诊断，展示组件运行状态和配置标志的监测信息。

---

LLMS index: [llms.txt](/llms.txt)

---

<!--
title: Kubernetes z-pages
content_type: reference
weight: 60
reviewers:
- dashpole
description: >-
  Provides runtime diagnostics for Kubernetes components, offering insights into component runtime status and configuration flags.
-->

<!-- overview -->








  <div class="feature-state-notice feature-beta">
      <span class="feature-state-name">特性状态：</span>
      <code>Kubernetes v1.36 [beta]</code>
    </div>
  



<!--
Kubernetes core components can expose a suite of _z-endpoints_ to make it easier for users
to debug their cluster and its components. These endpoints are strictly to be used for human
inspection to gain real time debugging information of a component binary.
In Kubernetes 1.36 these are **beta** features.
-->
Kubernetes 的核心组件可以暴露一系列 **z-endpoints**，以便用户更轻松地调试他们的集群及其组件。
这些端点仅用于人工检查，以获取组件二进制文件的实时调试信息。
在 Kubernetes 1.36 中，这些是 **Beta** 特性。

<!-- body -->

## z-pages

<!--
Kubernetes v1.36 allows you to enable _z-pages_ to help you troubleshoot
problems with its core control plane components. These special debugging endpoints provide internal
information about running components. For Kubernetes 1.36, components
serve the following endpoints (when enabled):
-->
Kubernetes v1.36 允许你启用 **z-pages**
来帮助排查其核心控制平面组件的问题。
这些特殊的调试端点提供与正在运行的组件有关的内部信息。
对于 Kubernetes 1.36，
这些组件提供以下端点（当启用 z-pages 后）：

- [z-pages](#z-pages)
	- [statusz](#statusz)
		- [statusz (structured)](#statusz-structured)
	- [flagz](#flagz)
		- [flagz (structured)](#flagz-structured)

### statusz

<!--
Enabled using the `ComponentStatusz` [feature gate](/docs/reference/command-line-tools-reference/feature-gates#ComponentStatusz),
the `/statusz` endpoint displays high level information about the component such as its Kubernetes version, emulation version, start time and more.

The `/statusz` plain text response from the API server is similar to:
-->
使用 `ComponentStatusz`
[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates#ComponentStatusz)启用后，
`/statusz` 端点显示有关组件的高级信息，例如其 Kubernetes
版本、仿真版本、启动时间等。

来自 API 服务器的 `/statusz` 纯文本响应类似于：

```
kube-apiserver statusz
Warning: This endpoint is not meant to be machine parseable, has no formatting compatibility guarantees and is for debugging purposes only.

Started: Wed Oct 16 21:03:43 UTC 2024
Up: 0 hr 00 min 16 sec
Go version: go1.23.2
Binary version: 1.32.0-alpha.0.1484&#43;5eeac4f21a491b-dirty
Emulation version: 1.32.0-alpha.0.1484
Paths: /healthz /livez /metrics /readyz /statusz /version
```

<!--
#### statusz (structured)
-->
#### statusz（结构化的）   {#statusz-structured}








  <div class="feature-state-notice feature-beta" title="特性门控： ComponentStatusz">
              <span class="feature-state-name">特性状态：</span> 
              <code>Kubernetes v1.36 [beta]</code>（默认启用）</div>


<!--
Starting with Kubernetes v1.35, the `/statusz` endpoint supports a structured,
versioned response format when requested with the appropriate `Accept` header.
Without an `Accept` header, the endpoint returns the plain text response format by default.

To request the structured response, use:
-->
从 Kubernetes v1.35 开始，`/statusz` 端点支持结构化的、版本化的响应格式，
前提是请求时使用了正确的 `Accept` 标头。
如果没有 `Accept` 标头，则该端点默认返回纯文本响应格式。

如需获取结构化回复，请使用：

```
Accept: application/json;v=v1beta1;g=config.k8s.io;as=Statusz
```


<div class="alert alert-info" role="note"><h4 class="alert-heading">说明：</h4><!--
If you request `application/json` without specifying all required parameters (`g`, `v`, and `as`),
the server will respond with `406 Not Acceptable`.
-->
<p>如果你请求 <code>application/json</code> 时未指定所有必需参数（<code>g</code>、<code>v</code> 和 <code>as</code>），
服务器将响应 <code>406 Not Acceptable</code>。</p></div>


<!--
Example structured response:
-->
结构化响应示例：

```json
{
  "kind": "Statusz",
  "apiVersion": "config.k8s.io/v1beta1",
  "metadata": {
    "name": "kube-apiserver"
  },
  "startTime": "2025-10-29T00:30:01Z",
  "uptimeSeconds": 856,
  "goVersion": "go1.23.2",
  "binaryVersion": "1.35.0",
  "emulationVersion": "1.35",
  "paths": [
    "/healthz",
    "/livez",
    "/metrics",
    "/readyz",
    "/statusz",
    "/version"
  ]
}
```

<!--
The `config.k8s.io/v1beta1` schema for the structured `/statusz` response is as follows:
-->
结构化 `/statusz` 响应的 `config.k8s.io/v1beta1` 模式如下：

```go
// Statusz is the config.k8s.io/v1beta1 schema for the /statusz endpoint.
type Statusz struct {
       // Kind is "Statusz".
       Kind string `json:"kind"`
       // APIVersion is the version of the object, e.g., "config.k8s.io/v1beta1".
       APIVersion string `json:"apiVersion"`
       // Standard object's metadata.
       // +optional
       Metadata metav1.ObjectMeta `json:"metadata,omitempty"`
       // StartTime is the time the component process was initiated.
       StartTime metav1.Time `json:"startTime"`
       // UptimeSeconds is the duration in seconds for which the component has been running continuously.
       UptimeSeconds int64 `json:"uptimeSeconds"`
       // GoVersion is the version of the Go programming language used to build the binary.
       // The format is not guaranteed to be consistent across different Go builds.
       // +optional
       GoVersion string `json:"goVersion,omitempty"`
       // BinaryVersion is the version of the component's binary.
       // The format is not guaranteed to be semantic versioning and may be an arbitrary string.
       BinaryVersion string `json:"binaryVersion"`
       // EmulationVersion is the Kubernetes API version which this component is emulating.
       // if present, formatted as "<major>.<minor>"
       // +optional
       EmulationVersion string `json:"emulationVersion,omitempty"`
       // MinimumCompatibilityVersion is the minimum Kubernetes API version with which the component is designed to work.
       // if present, formatted as "<major>.<minor>"
       // +optional
       MinimumCompatibilityVersion string `json:"minimumCompatibilityVersion,omitempty"`
       // Paths contains relative URLs to other essential read-only endpoints for debugging and troubleshooting.
       // +optional
       Paths []string `json:"paths,omitempty"`
}
```

### flagz

<!--
Enabled using the `ComponentFlagz` [feature gate](/docs/reference/command-line-tools-reference/feature-gates#ComponentFlagz), the `/flagz` endpoint shows you the command line arguments that were used to start a component.
-->
使用 `ComponentFlagz`
[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates#ComponentFlagz)启用后，
`/flagz` 端点为你显示用于启动某组件的命令行参数。


<div class="alert alert-info" role="note"><h4 class="alert-heading">说明：</h4><!--
`/flagz` reports command-line flags and defaults. For components that also load configuration files, such as the kubelet and kube-proxy, the effective running configuration can differ from `/flagz`; use `/configz` where available to inspect the merged component configuration.
-->
<p><code>/flagz</code> 报告命令行标志及其默认值。
对于同时加载配置文件（如 kubelet 和 kube-proxy）的组件，
其实际运行配置可能与 <code>/flagz</code> 显示的内容不同；
若可用，请使用 <code>/configz</code> 来查看合并后的组件配置。</p></div>


<!--
The `/flagz` plain text response from the API server looks something like:
-->
API 服务器的 `/flagz` 纯文本响应看起来类似于：

```
kube-apiserver flags
Warning: This endpoint is not meant to be machine parseable, has no formatting compatibility guarantees and is for debugging purposes only.

advertise-address=192.168.8.2
contention-profiling=false
enable-priority-and-fairness=true
profiling=true
authorization-mode=[Node,RBAC]
authorization-webhook-cache-authorized-ttl=5m0s
authorization-webhook-cache-unauthorized-ttl=30s
authorization-webhook-version=v1beta1
default-watch-cache-size=100
```

<!--
#### flagz (structured)
-->
#### flagz（结构化的）   {#flagz-structured}








  <div class="feature-state-notice feature-beta" title="特性门控： ComponentFlagz">
              <span class="feature-state-name">特性状态：</span> 
              <code>Kubernetes v1.36 [beta]</code>（默认启用）</div>


<!--
Starting with Kubernetes v1.35, the `/flagz` endpoint supports a structured,
versioned response format when requested with the appropriate `Accept` header.
Without an `Accept` header, the endpoint returns the plain text response format by default.

To request the structured response, use:
-->
从 Kubernetes v1.35 开始，`/flagz` 端点支持结构化、版本化的响应格式，
前提是请求时使用了正确的 `Accept` 标头。
如果没有 `Accept` 标头，则该端点默认返回纯文本响应格式。

要请求结构化响应，请使用：

```
Accept: application/json;v=v1alpha1;g=config.k8s.io;as=Flagz
```


<div class="alert alert-info" role="note"><h4 class="alert-heading">说明：</h4><!--
If you request `application/json` without specifying all required parameters (`g`, `v`, and `as`),
the server will respond with `406 Not Acceptable`.
-->
<p>如果你请求 <code>application/json</code> 时未指定所有必需参数（<code>g</code>、<code>v</code> 和 <code>as</code>），
服务器将响应 <code>406 Not Acceptable</code>。</p></div>


<!--
Example structured response:
-->
结构化响应示例：

```json
{
  "kind": "Flagz",
  "apiVersion": "config.k8s.io/v1beta1",
  "metadata": {
    "name": "kube-apiserver"
  },
  "flags": {
    "advertise-address": "192.168.8.4",
    "allow-privileged": "true",
    "anonymous-auth": "true",
    "authorization-mode": "[Node,RBAC]",
    "enable-priority-and-fairness": "true",
    "profiling": "true",
    "default-watch-cache-size": "100"
  }
}
```

<!--
The `config.k8s.io/v1beta1` schema for the structured `/flagz` response is as follows:
-->
结构化 `/flagz` 响应的 `config.k8s.io/v1beta1` 模式如下：

```go
// Flagz is the config.k8s.io/v1beta1 schema for the /flagz endpoint.
type Flagz struct {
       // Kind is "Flagz".
       Kind string `json:"kind"`
       // APIVersion is the version of the object, e.g., "config.k8s.io/v1beta1".
       APIVersion string `json:"apiVersion"`
       // Standard object's metadata.
       // +optional
       Metadata metav1.ObjectMeta `json:"metadata,omitempty"`
       // Flags contains the command-line flags and their values.
       // The keys are the flag names and the values are the flag values,
       // possibly with confidential values redacted.
       // +optional
       Flags map[string]string `json:"flags,omitempty"`
}
```


<div class="alert alert-info" role="note"><h4 class="alert-heading">说明：</h4><!--
The structured responses for both `/statusz` and `/flagz` are beta features in v1.36.
They are intended to provide machine-parseable output for debugging and introspection tools.
-->
<p><code>/statusz</code> 和 <code>/flagz</code> 的结构化响应在 v1.36 版本中处于 Beta 阶段，未来版本可能会有所更改。
它们旨在为调试和自省工具提供机器可解析的输出。</p></div>
