How to add extra status in a kubernetes pod?

112 views Asked by At

I have an application running in a kubernetes pod. User has options to enabled/disabled plugin for this application thru a set of REST API. One of the requirement is that user can use API to check what plugin is enabled/disabled.

Is there a way for me to report extra status in the pod status so that I can run a script in my pod to show what is enabled or not? Then the API can just directly retrieve the Pod object and display a list of plugin.

1

There are 1 answers

0
Wytrzymały Wiktor On

You should consider using labels and/or annotations:

You can use either labels or annotations to attach metadata to Kubernetes objects. Labels can be used to select objects and to find collections of objects that satisfy certain conditions. In contrast, annotations are not used to identify and select objects. The metadata in an annotation can be small or large, structured or unstructured, and can include characters not permitted by labels.

Kubernetes labels and annotations are both ways of adding metadata to Kubernetes objects. Kubernetes labels allow you to identify, select and operate on Kubernetes objects. Annotations however are non-identifying metadata. Therefore I believe that on your use case labels would fit better.