
Make kubernetes more friendly
Topic: Kubernetes annotations and why.
Usually read kubernetes manifest can be very hard if you want to undestant who did it and why, probably a lot of people and tools constanly updates this definitions in order to execute the many daily activities that your team or organization demands, so let’s talk a simple way yo make life better for every one.
We can add our intentions (commands), actions and states to our code to make easy to understand how our definitions has been change and why, cool right?
If you haven’t read about kubernetes annotations yet let me give you some brief examples of how to use it:
Ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
You can use annotations for:
- Fields managed by a declarative configuration layer. Attaching these fields as annotations distinguishes them from default values set by clients or servers, and from auto-generated fields and fields set by auto-sizing or auto-scaling systems.
- Build, release, or image information like timestamps, release IDs, git branch, PR numbers, image hashes, and registry address.
- Pointers to logging, monitoring, analytics, or audit repositories.
- Client library or tool information that can be used for debugging purposes: for example, name, version, and build information.
- User or tool/system provenance information, such as URLs of related objects from other ecosystem components.
- Lightweight rollout tool metadata: for example, config or checkpoints.
- Phone or pager numbers of persons responsible, or directory entries that specify where that information can be found, such as a team web site.
I remarked my favourite ones, owners contacts, release information, and workflow traceability, when they are in place life if much more easy.
Annotations are just a string value so you can even add complex objects like json to encapsulate a coplete subset of enrich information of a service, deployment or any other. After that if you continous delivery or observability is capable of understand it an used you are going to have a lot of fun and oportunities.
Imagine having this inside your manifest!
{
“release-info”: {
“git-commit”: “Hello World”,
“image-built”: “Hello World”,
“owner”: “Hello@World”,
“domain-name”: “Hello World”,
“app-set”: “Hello@World”,
“app-subset”: “Hello@World”,
“version”: “vHelloWorld”,
“last-change”: “wrong port”,
“change-log-url”: “https://changelog.html”
}
}
Without having to look at 10 places.
Of Course is not meant to be filled manually, need hard work on conventions and agreements and a lot of automation too but it worth!
Share your examples and the wonderful way you are using annotations :D
Best wishes and success.