Kubernetes Deep Dive Room

Sign Up Free or Log In to participate!

What is service to expose app on kubernetes

In the final quiz of the "Kubernetes Deep Dive" course there is a question:

You are deploying an application that exposes an API. You need other applications on your internal corporate LAN to be able to query the API. These applications will not be running on your Kubernetes cluster. Which type of Kubernetes Service would you deploy to make this work?

My – incorrect – answer was "LoadBalancer"

Answer pointed as correct was "NodePort"

Maybe II don’t get this question correctly, but what if cluster has 5 nodes, and 2 of them suddenly go down? How would these "other applications on your internal corporate LAN" detect that nodes went down and switch to other nodes?

Joe Armstrong

I had the same answer – which I think is more correct although NodePort would also work. I think the failure case you point out would not be solved by NodePort but would by LoadBalancer. FYI – I’m not a K8S expert by any means…

2 Answers

I also picked the load balancer answer. I did some reading and it looks like the load balancer is intended for exposing to the public internet. The quoted text below and the link to the documentation does a better job of explaining than I can.
“LoadBalancer: Exposes the Service externally using a cloud provider’s load balancer. NodePort and ClusterIP Services, to which the external load balancer routes, are automatically created.”

As I understand:-

Port → to access within cluster using ClusterIP

NodePort → To access from outside of cluster, using nodeIP, within LAN.

LoadBalancer → To access from Public.

So, Nodeport answer is correct, as question talks about LAN.

Bruno Gabriel da Silva

I agree with you.. Since there is no External access mentioned in the question, NodePort seems to be the correct. Usually in this kind of tech tests, you need to remember ( "Ok there is "2" correct here), let me check witch is the cheaper, os faster that meet the question requirements… In this case NodePort

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?