How do I know the list of all possible statuses and reasons in Kubernetes?
Right now, I'm working with Kubernetes events. Based on certain unusual events, I will be reacting to it. For example, if a pod is backed off or pending, will receive such events and get notified via Email (custom code). Necessary actions would be taken further for each such events.
I have to know the list of all possible status for a pod and node. That would help me to handle uncommon behaviours in my code. If possible, it would be good to know the list of possible Events' reasons also.
I'm using Fabric8 kubernetes-client as I found some issues with Java Kubernetes-client for handling events.
The way I searched through Google, couldn't get some results.
If you need to have a complete list of events
in Kubernetes, you should take a look directly to the Kubernetes
project on github.
Here the link to the event.go
file.
A phase of a Pod is a simple, high-level summary of where the Pod is in its lifecycle.
The phase is not intended to be a comprehensive rollup of observations of Container or Pod state, nor is it intended to be a comprehensive state machine.
Here are the possible values for phase:
Pending
The Pod has been accepted by the Kubernetes system, but one or more of the Container images has not been created. This includes time before being scheduled as well as time spent downloading images over the network, which could take a while.
Running
The Pod has been bound to a node, and all of the Containers have been created. At least one Container is still running, or is in the process of starting or restarting.
Succeeded
All Containers in the Pod have terminated in success, and will not be restarted.
Failed
All Containers in the Pod have terminated, and at least one Container has terminated in failure. That is, the Container either exited with non-zero status or was terminated by the system.
Unknown
For some reason the state of the Pod could not be obtained, typically due to an error in communicating with the host of the Pod.
If you are interested in detailed arrays with Pod conditions, I suggest looking at Pod Lifecycle from Kubernetes documentation and inspect source code for remaining information.
I have been able to document a few extras:
Terminating
The pod is attempting to terminate; if a pod is stuck in this state something has happened that has prevented the process from succeeding (this could be a zombie process or, sometimes, problems with a mounted volume)
ContainerCreating
Something is wrong with the configuration for a container required by this pod; may be a miss-typed container name or some network configuration issues
Error
Kind of a catch-all; may not be particularly useful. If you see this a lot, it might be a good idea to check out this doc