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

相关推荐
Wpa.wk14 小时前
容器编排 - 了解K8s(pod, deployment,service,lable等概念)
经验分享·测试工具·docker·云原生·容器·kubernetes
江畔何人初14 小时前
kubernet与docker的关系
linux·运维·云原生
xuefuhe15 小时前
Kubernetes基础入门4 应用的扩展与收缩
云原生·容器·kubernetes
Wpa.wk16 小时前
容器编排 - K8s - 配置文件参数说明和基础命令
经验分享·测试工具·docker·云原生·容器·kubernetes
掘根20 小时前
【即时通讯系统】项目框架与微服务拆分设计
微服务·云原生·架构
杭州杭州杭州20 小时前
Docker
运维·docker·容器
一体化运维管理平台20 小时前
容器监控难题破解:美信监控易全面支持K8s、Docker
云原生·容器·kubernetes
江畔何人初21 小时前
service发现
linux·运维·云原生
造夢先森21 小时前
Clawdbot(OpenClaw)安装部署教程
人工智能·微服务·云原生
qiubinwei21 小时前
kubeadm部署K8S集群(踩坑实录)
云原生·容器·kubernetes