Difference between Replication Controller and LivenessProbs in K8S

8/12/2019

I'm just confused between the replication controller and livenessProbs in K8S. Could anyone explain this?

-- Arun Venkat
kubernetes

3 Answers

8/12/2019

Replication controller is older version of replicasets.

replication controller basically manage the state of replicas running inside kubernetes cluster.

Replication controller use at cluster level.

Liveness probe use at pod level. Liveness probe constantly on a frequent base ping one endpoint and check for the service liveness.if service is not live it will restart the pod.

-- Harsh Manvar
Source: StackOverflow

8/12/2019

ReplicationController and livenessProbe have nothing common.

Replication Controller in K8s makes sure that a specified number of pod replicas are running at any one time. Those pods supposed to be always up and available.

If there are too many pods, the ReplicationController terminates the extra pods. If there are too few, the ReplicationController starts more pods. Unlike manually created pods, the pods maintained by a ReplicationController are automatically replaced if they fail, are deleted, or are terminated.

Example Replication Controller config file:

apiVersion: v1
kind: ReplicationController
metadata:
  name: nginx
spec:
  replicas: 3
  selector:
    app: nginx
  template:
    metadata:
      name: nginx
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx
        ports:
        - containerPort: 80

Workflow of Replication Controllers:

enter image description here

More information you can find here: Replication Controller.

Useful articel: replication controller actions.

Liveness probe in K8s.

A Probe is a diagnostic performed periodically by the kubelet on a Container. To perform a diagnostic, the kubelet calls a Handler implemented by the Container.

The kubelet can optionally perform and react to two kinds of probes on running Containers:

livenessProbe: Indicates whether the Container is running. If the liveness probe fails, the kubelet kills the Container, and the Container is subjected to its restart policy. If a Container does not provide a liveness probe, the default state is Success.

More information you can find here: pod lifecycle.

Useful article: Kubernetes probes.

-- MaggieO
Source: StackOverflow

8/12/2019

ReplicationController and livenessProbe have nothing common so it is really hard to be confused, moreover Kubernetes documentation (check links) has a great explanation for both these objects.

-- FL3SH
Source: StackOverflow