<p>I am creating a two node Kubernetes cluster (1 master and 2 slave nodes) which will host Netflix eureka. Microservices would be created for applications which would register themselves on the Eureka server and would find other microservices to communicate from the service registry of Eureka.I want a scenario such that if any node fails, then how can we achieve high availability in this ? Also , there should be load balancing so that requests get simultaneously directed to other nodes in the cluster.</p>

<p>Can anybody let me know a solution for this ?</p>

<blockquote>
  <p>I want a scenario such that if any node fails, then how can we achieve high availability in this </p>
</blockquote>

<p>Creating a Pod directly is not a recommended approach. Lets say that the node on which the Pod is running crashes, then the Pod is not rescheduled and the service is not accessible.</p>

<p>For HA (High Availability), higher level abstractions like <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/" rel="nofollow noreferrer">Deployments</a> should be used. A Deployment will create a ReplicaSet which will have multiple Pods associated with it. So, if a node on which the Pod is running crashes then the ReplicaSet will automatically reschedule the Pod on a healthy node and you will get HA.</p>

<blockquote>
  <p>Also , there should be load balancing so that requests get simultaneously directed to other nodes in the cluster.</p>
</blockquote>

<p>Create a Service of <a href="https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer" rel="nofollow noreferrer">type LoadBalancer</a> for the Deployment and the incoming requests will be automatically redirected to the Pods on the different nodes. In this case a Load Balancer will be automatically created. And there is charge associated with the Load Balancer.</p>

<p>If you don't want to use a Load Balancer then another approach though which is a bit more complicated and powerful is to use <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/" rel="nofollow noreferrer">Ingress</a>. This will also load balance the requests across multiple nodes.</p>

<p><a href="https://medium.com/google-cloud/kubernetes-nodeport-vs-loadbalancer-vs-ingress-when-should-i-use-what-922f010849e0" rel="nofollow noreferrer">Here</a> is a nice article explaining the difference between a Load Balancer and Ingress.</p>

<p>All the above queries are addressed directly or indirectly in the K8S documentation <a href="https://kubernetes.io/docs/home/" rel="nofollow noreferrer">here</a>.</p>
