sensu-plugins / sensu-plugins-kubernetes

Sensu plugins for Kubernetes
http://sensu-plugins.io
MIT License
28 stars 36 forks source link

service available check to support 'all' services #17

Closed GKTheOne closed 5 years ago

GKTheOne commented 8 years ago

Currently the check-kube-service-available script requires an explicit service list. I'd like it to be able to verify all services in the cluster.

Note: I do have some code for this but I want to see how PR #16 goes first.

Also, as a general question, what is the opinion on validating selector-less services?

At the moment the script would look through ALL pods in the cluster for a selector-less service, which is probably a bug. My thought is to just check that a selector-less service has an endpoint.

(Actually my thought is to check for an endpoint for all services and rely on Kubernetes readiness checks to add/withdraw endpoints, along with the check-kube-pods-pending script this should cover the functionality of the check-kube-service-available script and cover all services. It would also cover the case where a pod is Ready, but it's readiness check prevents it from being a service endpoint)

sstarcher commented 8 years ago

@GKTheOne #16 was merged. I can't currently think of a case where a selector-less service would be a valid service definition.

GKTheOne commented 8 years ago

We use them in our clusters so that code can be written environment agnostic.

eg, "third-party.external" can point to a mock service in the test environment, but the real third-party host(s) in production.

http://kubernetes.io/docs/user-guide/services/#services-without-selectors

majormoses commented 7 years ago

@sstarcher can we discuss this and possibly re-open the PR as it sounds like it is still valid?

sstarcher commented 7 years ago

Your use case of wanting to check the health of a service without a selector is a valid case, but I believe it's a separate case from the usecase for the current check-kube-service-available as it relies on the kubernetes probes.

To validate the health of a service that does not have a pod would need to be a bespoke action per service as it does not have probes that can validate it's health.

GKTheOne commented 5 years ago

n/a