kubernetes webinar series - understanding service discovery

13
Understanding Service Discovery in Kubernetes Janakiram MSV Analyst | Advisor | Architect Janakiram & Associates Google Developer Expert Joseph Jacks Sr. Director Apprenda Founder, KubeCon

Upload: janakiram-msv

Post on 11-Jan-2017

99 views

Category:

Technology


2 download

TRANSCRIPT

Understanding Service Discovery in Kubernetes Janakiram MSVAnalyst | Advisor | ArchitectJanakiram & AssociatesGoogle Developer Expert

Joseph JacksSr. DirectorApprenda Founder, KubeCon

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

Objectives

● What is a Kubernetes Service● Service Discovery through Environment Variables● Service Discovery through DNS● Service Types

○ ClusterIP○ NodePort○ LoadBalancer

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

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

Kubernetes Cluster

Understanding Services

Node 1 Node 2 Node 3

S1 S2 S3 S4

DemoCreating a Service

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

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

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

DemoExposing a Service Internally and

Externally

Upcoming WebinarMigrating Docker Swarm Apps to Kubernetes9AM 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

Thank You!Send your Feedback / Questions / Comments [email protected]