k8s crd设置额外header

可以通过设置crd.spec.additionalPrinterColumns来实现:

XML 复制代码
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: crontabs.stable.example.com
spec:
  group: stable.example.com
  scope: Namespaced
  names:
    plural: crontabs
    singular: crontab
    kind: CronTab
    shortNames:
    - ct
  versions:
  - name: v1
    served: true
    storage: true
    schema:
      openAPIV3Schema:
        type: object
        properties:
          spec:
            type: object
            properties:
              cronSpec:
                type: string
              image:
                type: string
              replicas:
                type: integer
    additionalPrinterColumns:
    - name: Spec
      type: string
      description: The cron spec defining the interval a CronJob is run
      jsonPath: .spec.cronSpec
    - name: Replicas
      type: integer
      description: The number of jobs launched by the CronJob
      jsonPath: .spec.replicas
    - name: Age
      type: date
      jsonPath: .metadata.creationTimestamp

参考:

使用 CustomResourceDefinition 扩展 Kubernetes API | Kubernetes

相关推荐
阿里云云原生5 小时前
AgentLoop × Qoder:采集自动装,审计直接问
云原生·agent
A-刘晨阳6 小时前
K8S 二进制集群搭建(一主两从)v1.37.2 版本
运维·云原生·容器·kubernetes·calico·nerdctl
lambo mercy8 小时前
01初识docker
运维·docker·容器
时间的拾荒人9 小时前
Docker 容器、仓库与数据管理实战
docker·容器·eureka
阿里云云原生9 小时前
云原生开源项目周报(2026 / 11.09 — 11.16)
云原生·开源
时间的拾荒人10 小时前
Docker 入门实战:从核心概念、安装配置到镜像操作与 Dockerfile 定制
运维·docker·容器·eureka
goyeer12 小时前
【Kubernetes】Kubernetes之CRI详解
java·容器·kubernetes
wz975412 小时前
Kubernetes Pod 深度详解:K8s 最小调度单元
云原生·容器·kubernetes
阿里云云原生1 天前
给团队招个“运维专家”:STAROps 订阅套餐上线,499.5 元/月起
云原生
分布式存储与RustFS1 天前
RustFS 分片上传怎么配:大文件断点续传的最小可验证流程
运维·云原生·开源·对象存储·分布式存储·s3·性能基准