a closer look at kubernetes pods and replica sets

16
Taking a Closer Look at Pods and Replica Sets 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

119 views

Category:

Technology


0 download

TRANSCRIPT

Taking a Closer Look at Pods and Replica SetsJanakiram 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

● Understand the concept of Pods● Explore multi-container Pods● Closer look at use cases and scenarios for multi-container pods● Scaling Pods through Replica Sets

What is Pod?

● A group of one or more containers that are always co-located and co-scheduled that share the context

● Containers in a pod share the same IP address, ports, hostname and storage

● Modeled like a virtual machine -○ Each container represents one process○ Tightly coupled with other containers in the same pod

● Pods are scheduled in Nodes● Fundamental unit of deployment in Kubernetes

DemoCreating First Pod

What is a Pod?

A multi-container pod that contains a file puller and a web server that uses a persistent volume for shared storage between the containers.

● Containers within the same pod communicate with each other using IPC

● Containers can find each other via localhost● Each container inherits the name of the pod● Each pod has an IP address in a flat shared

networking space● Volumes are shared by containers in a pod

Use Cases for Pod

● Content management systems, file and data loaders, local cache managers, etc.

● Log and checkpoint backup, compression, rotation, snapshotting, etc.● Data change watchers, log tailers, logging and monitoring adapters,

event publishers, etc.● Proxies, bridges, and adapters● Controllers, managers, configurators, and updaters

Pod Definition

Container 1

Container 2

Multi-Container Pod with Python and Redis

Python Container

Redis Container

Web Pod DB Pod

MySQL ContainerService

DemoExploring a Multi-Container Pod

Replication Controller

● Ensures that a Pod or homogeneous set of Pods are always up and available

● Always maintains desired number of Pods○ If there are excess Pods, they get killed○ New pods are launched when they fail, get deleted, or terminated

● Creating a replication controller with a count of 1 ensures that a Pod is always available

● Replication Controller and Pods are associated through Labels

Replica Set

● Replica Sets are the next generation Replication Controllers● Ensures specified number of pods are always running● Pods are replaced by Replica Sets when a failure occurs

○ New pods are automatically scheduled

● Labels and Selectors are used for associating Pods with Replica Sets● Usually combined with Pods when defining the deployment

DemoScaling Replica Sets

Summary

● Pods are the smallest unit of deployment in Kubernetes● Multiple containers share the context of a Pod● Replica Sets are the next generation Replication Controllers● Replication Controllers ensure high availability of Pods● Scripts and source code for demos shown is available on Github

Upcoming WebinarUnderstanding Services9AM PST, Wednesday, Nov. 23rd

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.

Register at kubernetes.live for the upcoming webinars

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