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

相关推荐
ai_coder_ai1 小时前
论模型驱动分析方法及应用
微服务·云原生·架构
Hiyajo pray2 小时前
云原生场景下:sdn 访问控制优化方案
云原生
前端Baymax2 小时前
kube-proxy iptables模式下NodePort间歇性超时
docker·容器·kubernetes
欢醉2 小时前
k8s的pod容器中微服务无法创建新线程unable to create new native thread
kubernetes·springboot
一只积极向上的小咸鱼3 小时前
多机Docker + InfiniBand 分布式运行实操手册
分布式·docker·容器
留不住的何止是时间3 小时前
关于docker构建镜像build指令的注意事项
运维·docker·容器
小兔崽子去哪了18 小时前
Docker 删除镜像后磁盘空间没有释放?
后端·docker·容器
laoli_coding18 小时前
系统部署之框架选型方案
微服务·云原生·架构
Zhu75819 小时前
在Docker环境部署ApacheGuacamole,对接PG数据库
数据库·docker·容器
少陽君20 小时前
Docker 部署 Loki + Promtail + Grafana 日志监控栈
docker·容器·grafana