dougui2254 2018-08-20 02:33
浏览 13

kubernetes服务对象的命中数

I am writing a custom Kubernetes controller and resource to keep track of the number of times a service object is called. The idea behind this is to add a "hitcount" field to the resource and update it every time a service is invoked. (Meaning update the count every time a request is made to the pod that is part of the service)

Is this possible? Does the kubernetes API have an option to do this?

  • 写回答

1条回答 默认 最新

  • dota220141003 2018-08-20 07:19
    关注

    it sounds like you're in fact trying to implement a metric inside kubernetes api. It's hardly a controller though. In a nutshell, controller is piece of software that continuously realizes an intent stated in kubernetes API in a real world.

    Semantics aside, status object in kubernetes API is defined in it's type. For Pod, at the moment of writing of this answer it's here and it's not an extensible one. So you can't really put your metric into the Pod object.

    The question that this naturally poses is why not use something that is expected for metrics collection and visualization like prometheus/grafana ?

    All of that aside, you also have an issue of how will you expose/collect that metric. Istio could help here, or the software in pod it self could expose it's metrics (which, if possible, is the best route to take imo)

    评论

报告相同问题?

悬赏问题

  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用