You are using Google Kubernetes Engine with autoscaling enabled to host a new application. You want to expose this new application to the public, using HTTPS on a public IP address. What should you do?
A.
Create a Kubernetes Service of type NodePort for your application, and a Kubernetes Ingress to expose this Service via a Cloud Load Balancer.
B.
Create a Kubernetes Service of type ClusterIP for your application. Configure the public DNS name of your application using the IP of this Service.
C.
Create a Kubernetes Service of type NodePort to expose the application on port 443 of each node of the Kubernetes cluster. Configure the public DNS name of your application with the IP of every node of the cluster to achieve load-balancing.
D.
Create a HAProxy pod in the cluster to load-balance the traffic to all the pods of the application. Forward the public traffic to HAProxy with an iptable rule. Configure the DNS name of your application using the public IP of the node HAProxy is running on.
HAProxy is HTTP only, doesnt support HTTPS, so you can reject option D
https://www.haproxy.org/#desc
Cluster IP - is an internal IP, you cannot expose public externally. reject option B
out of option A and C
C, port 443 is https but public DNS is not going to give you a load balancing
A is the right choice,
kubernets ingress exposes HTTPS
https://kubernetes.io/docs/concepts/services-networking/ingress/
and cloud load balancer is the right choice which will help to expose the app to public
Saw this which provides good context https://medium.com/google-cloud/kubernetes-nodeport-vs-loadbalancer-vs-ingress-when-should-i-use-what-922f010849e0
option A is correct, but do not use it in real deployments, it is a bad practice. I am wondering why they didn't mention Cluster IP and exposing it via an ingress or at least a service of type loadbalancer
In Kubernetes, a Service of type NodePort is a way to expose your applications to external traffic. It's one of the several types of Services available in Kubernetes to control how external sources can access services running within the cluster. Here's what a NodePort service entails:
Exposing Services Outside the Cluster:
A NodePort service makes your application accessible from outside the Kubernetes cluster by opening a specific port (the NodePort) on all the nodes (VMs) in your cluster. This port is randomly selected from a defined range (default: 30000-32767) unless you specify a particular port.
When a NodePort service is created, each node in the cluster allocates the specified NodePort. External traffic can access the service by hitting any node's IP address at the NodePort, regardless of whether that node is actually running a pod for the service.
Kubernetes internally routes that traffic to the appropriate pods, even if they are running on different nodes.
To expose a new application hosted on Google Kubernetes Engine with autoscaling enabled to the public using HTTPS on a public IP address, the most appropriate option would be;
A. Create a Kubernetes Service of type NodePort for your application, and a Kubernetes Ingress to expose this Service via a Cloud Load Balancer.
Correct answer is A. Create a Kubernetes Service of type NodePort for your application, and a Kubernetes Ingress to expose this Service via a Cloud Load Balancer.
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
arsav
Highly Voted 3 years, 9 months agoNoniGeorge
2 years, 10 months agodan80
Highly Voted 4 years, 5 months agomagistrum
3 years, 11 months agonitinz
3 years, 9 months agoyehia2221
Most Recent 4 months agoCynthia2023
11 months agoCynthia2023
11 months agoBAofBK
1 year agoCaptain1212
1 year, 2 months agofrantishk
1 year, 3 months agotrainingexam
1 year, 5 months agoBuruguduystunstugudunstuy
1 year, 9 months agoGS300
1 year, 10 months agocslince
1 year, 11 months agogcpBeginner
2 years, 2 months agoCornholio_LMC
2 years, 2 months agoNOOGLer
2 years, 4 months agoAzureDP900
2 years, 5 months agoharoldbenites
2 years, 5 months agoBalajiMBala
2 years, 7 months ago