What happens if a kubernetes Service fails?

3/21/2019

I just learned about ReplicaSets and Services in Kubernetes. I know the concept of desired state in ReplicaSets, it means that if one of our pods goes down, it will be rescheduled to keep the number of replicas as desired.

But what happens if a Service goes down/fails? Is there any recovery for that?

-- hey_you
kubernetes

2 Answers

3/21/2019

One of the main reasons the service gets broken is, if you mess up the ip table rules on the host machine. Service object in kubernetes doesn't consume any cluster resources. It just enables kube proxy to define the routing rules for the pods that are selected by the service.

You can verify and create service if it doesn't exist

-- P Ekambaram
Source: StackOverflow

3/21/2019

A Kubernetes Service is an abstraction which defines a logical set of Pods and a policy by which to access them - sometimes called a micro-service. The set of Pods targeted by a Service is (usually) determined by a Label Selector (see below for why you might want a Service without a selector). service

k8s service is a abstract idea it does not consume any cpu/memory as pod does, so it does not make sense if it goes down. If you delete it then its deleted, there is no concrete object which is active.

one of the functionally is to provide static IP (cluster IP) and DNS record so other pods can communicate with it, inter cluster communication. DNS record

One of the main responsibilities of kube-proxy is to write the iptables rules which implement Services. Nodes are having same iptables rules which are synchronized by kube-proxy.

-- Suresh Vishnoi
Source: StackOverflow