The Guide to Kubernetes Labels
blog.kubecost.com
blog.kubecost.com
> Instead, Kubernetes annotations are meant for sharing information with other colleagues. For example, you may use an annotation to record the phone number of the person responsible for a pod
...wat? The k8s docs say
> You can use Kubernetes annotations to attach arbitrary non-identifying metadata to objects. Clients such as tools and libraries can retrieve this metadata.
I've only ever seen them used in this fashion, i.e. declarative configuration facilitated by the control plane. Furthermore why would you have a _phone number_ as an annotation on a _pod_? If you're managing pods individually without a controller of some sort then you'd better have a really good reason.
Namespace onboarding is self-service by pull request: a template namespace is in the readme, and contains a number of standard annotations like ldap group and etc. The kubernetes admin team accepts and merges those requests and the bot deploys the namespace folder to the clusters.
This is basically zero overhead at small groups and scales well to giant companies, you just add annotations and sometimes labels as business requirements and structure dictate.
> Instead, Kubernetes annotations are meant for sharing information with other colleagues. For example, you may use an annotation to record the phone number of the person responsible for a pod
But it can be super helpful to put owner/contact info for alerting purposes as teams scale.
I also agree that having this metadata on the controller is helpful.
I tried to use Kubecost but could not find any option at all to do what I wanted. My labels never appeared on the Kubecost UI. It's funny now to see an article about labels knowing that Kubecost itself doesn't seem to support them.
I wouldn't necessarily put _user_ data in labels, but team/product names and contact info of the coworkers responsible for the service seem fine to me.
kube-state-metrics does its own service discovery and outputs prometheus metrics that it cares about, but any app could do that.
It sounds great in theory ("lemme query all my pods in staging", "lemme find secrets by the marketing team") but it's just not used for some reason. I think people like flat organization (e.g. "find deployment X") more than searching by labels.