Services in Kubernetes act as the glue between various objects that communicate with each other. In this webinar, we will learn how to use Services to securely expose Pods to internal and external consumers. This session builds upon the concepts of Pods, Replica Sets that were covered in the previous webinars.
Kubernetes Webinar Series - Understanding Service Discovery
1. Understanding Service
Discovery in Kubernetes
Janakiram MSV
Analyst | Advisor | Architect
Janakiram & Associates
Google Developer Expert
Joseph Jacks
Sr. Director
Apprenda
Founder, KubeCon
2. Announcing
The Kubernetes Webinar Series
● Monthly webinar focused on helping you get started with Kubernetes
● Delivered by the experts from the container ecosystem
● Each webinar introduces a concept to accelerate your learning
● No specific prerequisites
○ Basic understanding of Docker will help
● All attendees will get $100 Google Cloud Platform Credits
● Win free annual and monthly subscriptions of MAPT eBook library
● The recording of this webinar will be available at Kubernetes.live
3. Objectives
● What is a Kubernetes Service
● Service Discovery through Environment Variables
● Service Discovery through DNS
● Service Types
○ ClusterIP
○ NodePort
○ LoadBalancer
4. Quick Recap - Pods and Replication Controllers
● Pods are fundamental units of deployment
● Each Pod has one or more containers that may expose ports
● Each Pod has a routable IP address assigned to it
● Labels are used to logically identify Pods that match a specific criterion
● Replication Controller’s Selector matches the Pods based on Labels
● Replication Controller maintains the desired count of Pods all the time
● Pod IP address may change during its lifetime
5. What is a Kubernetes Service?
● A Service is an abstraction of a logical set of Pods defined by a policy
● It acts as the intermediary for Pods to talk to each other
● Selectors are used for accessing all the Pods that match a specific Label
● Service is an object in Kubernetes - similar to Pods and RCs
● Each Service exposes one of more ports and targetPorts
● The targetPort is mapped to the port exposed by matching Pods
● Kubernetes Services support TCP and UDP protocols
8. Discovering Services - Env Vars
● Kubernetes creates Docker Link compatible environment variables in
all Pods
● Containers can use the environment variable to talk to the service
endpoint
9. Discovering Services - DNS
● The DNS server watches Kubernetes API for new Services
● The DNS server creates a set of DNS records for each Service
● Services can be resolved by the name within the same namespace
● Pods in other namespaces can access the Service by adding the
namespace to the DNS path
○ my-service.my-namespace
10. Service Types
● ClusterIP
○ Service is reachable only from inside of the cluster.
● NodePort
○ Service is reachable through <NodeIP>:NodePort address.
● LoadBalancer
○ Service is reachable through an external load balancer mapped to
<NodeIP>:NodePort address
12. Upcoming Webinar
Migrating Docker Swarm Apps to Kubernetes
9AM PST, Thursday, Dec. 15th
This webinar will walk you through the steps involved in migrating a
multi-container application deployed in Docker Swarm to Kubernetes. It
will map the concepts of Swarm to Kubernetes. Attend this webinar to
learn how to apply your Docker skills to Kubernetes for running and
managing containerized applications in production.
Register at kube.live for the upcoming webinars