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

相关推荐
milo.qu8 小时前
RockyLinux9.7 docker部署Jisti Meet
linux·docker·容器
梦想与想象-广州大智汇10 小时前
自建docker加速镜像,使用 Cloudflare Workers/Pages 部署加速教程
运维·docker·容器
AI攻城狮12 小时前
为什么主流大厂 LLM 必须亲自下场做 Harness CLI:从 DeepSeek TUI 说开去
云原生
阿里云云原生13 小时前
阿里云 AI 网关支持 DeepSeek V4
云原生
阿里云云原生14 小时前
从可观测到可理解:用 UModel 构建 Agent 原生的代码知识图谱
云原生
阿里云云原生15 小时前
OpenClaw、Hermes合用?来自500+社区互动的真实看法
云原生
AI攻城狮17 小时前
开源工具也有山寨陷阱:一个假 Hermes Agent 网站如何收割不明真相的用户
云原生
阿里云云原生17 小时前
人机共跑半马,赛场之外的具身智能规模化运维大考
云原生
宁静@星空18 小时前
007-Docker构建 jar 包成镜像
docker·容器·jar
A-刘晨阳20 小时前
K8s之负载均衡
linux·运维·容器·kubernetes·负载均衡