CloudNative

Kubernetes – Practice Test / Interview Q&A on Service Discovery

This article represents concepts, revision / quick notes, and practice or sample test/interview questions and answers on Service Discovery topic of Kubernetes. These notes, Q&A could provide to be helpful for those appearing for Kubernetes administrator certification exams (CKA).


Revision Notes – Service Discovery

  • Kubernetes supports the following two modes of service discovery:
    • Environment variable
    • DNS
  • Service environment details can be set based on the following format. Service name needs to be in uppercase.
    • {SVCNAME}_SERVICE_HOST
    • {SVCNAME}_SERVICE_PORT
  • When using environment variables for service discovery, it is a mandate that the services must be created prior to the pods which want to access those services.
  • DNS server creates a set of records for each service discovered via watching Kubernetes APIs.
  • Services of type ExternalName can only be accessed through DNS server.
  • For headless service (exposed with a single service IP) not requiring load balancer, the cluster IP (spec.clusterIP)should be specified as None.
  • A service can be reached based on the ServiceType assigned to it. The details can be found on this page, Service types
    • ClusterIP: The service can be reached from within the cluster
    • NodePort: The service can be reached from outside the cluster at the address NodeIP:NodePort. The port is a static port. The request is then routed to appropriate clusterIP service. Note that the clusterIP service gets created automatically. The port number supported must fall in the range, 30000-32767
    • LoadBalancer: The service can be reached from the load balancer. The NodePort and ClusterIP services to which request from load balancer will be routed are created automatically.
    • ExternalName: The service can be mapped to the content of ExternalName.
  • Kubernetes support the notion of the internal load balancer for route traffic from services inside the same VPC. For different cloud providers AWS, Azure or GCP, different configuration annotation need to be applied. Details could be found on this page, internal load balancer
  • Kubernetes supports network load balancer starting version 1.9.



Practice Test – Service Discovery

[wp_quiz id=”6192″]

Other Practice Tests / Interview Questions and Answers



References

Ajitesh Kumar

I have been recently working in the area of Data analytics including Data Science and Machine Learning / Deep Learning. I am also passionate about different technologies including programming languages such as Java/JEE, Javascript, Python, R, Julia, etc, and technologies such as Blockchain, mobile computing, cloud-native technologies, application security, cloud computing platforms, big data, etc. I would love to connect with you on Linkedin. Check out my latest book titled as First Principles Thinking: Building winning products using first principles thinking.

Recent Posts

Retrieval Augmented Generation (RAG) & LLM: Examples

Last updated: 25th Jan, 2025 Have you ever wondered how to seamlessly integrate the vast…

1 week ago

How to Setup MEAN App with LangChain.js

Hey there! As I venture into building agentic MEAN apps with LangChain.js, I wanted to…

2 weeks ago

Build AI Chatbots for SAAS Using LLMs, RAG, Multi-Agent Frameworks

Software-as-a-Service (SaaS) providers have long relied on traditional chatbot solutions like AWS Lex and Google…

2 weeks ago

Creating a RAG Application Using LangGraph: Example Code

Retrieval-Augmented Generation (RAG) is an innovative generative AI method that combines retrieval-based search with large…

3 weeks ago

Building a RAG Application with LangChain: Example Code

The combination of Retrieval-Augmented Generation (RAG) and powerful language models enables the development of sophisticated…

3 weeks ago

Building an OpenAI Chatbot with LangChain

Have you ever wondered how to use OpenAI APIs to create custom chatbots? With advancements…

3 weeks ago