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

相关推荐
2301_7807896626 分钟前
零信任时代:WAF 从边界防护到微隔离的架构跃迁
网络·安全·web安全·kubernetes·ddos
隔窗听雨眠1 小时前
生产级Kubernetes集群部署完全指南:从kubeadm到高可用架构落地
容器·架构·kubernetes
瞬间&永恒~2 小时前
【Docker】(三)联合文件系统UnionFS + Overlay2
docker·云原生·容器
逐光老顽童6 小时前
第 5 章:搞懂 K8s Service:从 ClusterIP 到负载均衡
docker·云原生·容器
SLD_Allen6 小时前
DRA、MIG与GPU共享的云原生AI实践
人工智能·云原生
yunwei376 小时前
eBPF 入门实践教程第五十篇:使用 TCX Link 实现可组合的流量控制
linux·云原生·开源
qq_452396236 小时前
第一篇:《服务网格是什么?为什么云原生需要它?》
云原生
逐光老顽童7 小时前
第 2 章:彻底搞懂 K8s Pod——从 YAML 到调度全流程
分布式·云原生
运维大师7 小时前
【K8S 运维实战】34-多集群管理Karmada
java·运维·kubernetes