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

相关推荐
浪兎兎2 小时前
【Kubernetes 实战】(二)部署 Ruoyi-Cloud —— 部署服务
云原生·容器·kubernetes
淼澄研学2 小时前
Proliferate开源框架技术解析与Docker部署实操
docker·容器·开源
浪兎兎3 小时前
Docker 容器技术笔记
笔记·docker·容器
Zhu7585 小时前
在Docker环境离线部署最新版Harbor
运维·docker·容器
大大大大晴天5 小时前
K8S 在大数据里的真正价值:适用场景、收益边界与不适合的地方
大数据·云原生
众人皆醒我独醉5 小时前
流量路由:Istio 与 Knative 的集成
面试·kubernetes·llm
众人皆醒我独醉5 小时前
模型加载:storage-initializer 与节点级缓存
面试·kubernetes·gpu
Henry-SAP5 小时前
AI与机器人信息新闻
人工智能·云原生·sap·erp
阿里云云原生6 小时前
深入解析阿里云 SysOM AI Profiling:如何实现零侵入的AI作业全生命周期观测?
云原生
SakitamaX6 小时前
pod管理及其相关实验
运维·kubernetes