Top Banner
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
16

A Closer Look at Kubernetes Pods and Replica Sets

Jan 11, 2017

Download

Technology

Janakiram MSV
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: A Closer Look at Kubernetes Pods and Replica Sets

Taking a Closer Look at Pods and Replica SetsJanakiram MSVAnalyst | Advisor | ArchitectJanakiram & AssociatesGoogle Developer Expert

Joseph JacksSr. DirectorApprenda Founder, KubeCon

Page 2: A Closer Look at Kubernetes Pods and Replica Sets

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

Page 3: A Closer Look at Kubernetes Pods and Replica Sets

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

Page 4: A Closer Look at Kubernetes Pods and 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

Page 5: A Closer Look at Kubernetes Pods and Replica Sets

DemoCreating First Pod

Page 6: A Closer Look at Kubernetes Pods and Replica Sets

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

Page 7: A Closer Look at Kubernetes Pods and Replica Sets

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

Page 8: A Closer Look at Kubernetes Pods and Replica Sets

Pod Definition

Container 1

Container 2

Page 9: A Closer Look at Kubernetes Pods and Replica Sets

Multi-Container Pod with Python and Redis

Python Container

Redis Container

Web Pod DB Pod

MySQL ContainerService

Page 10: A Closer Look at Kubernetes Pods and Replica Sets

DemoExploring a Multi-Container Pod

Page 11: A Closer Look at Kubernetes Pods and Replica Sets

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

Page 12: A Closer Look at Kubernetes Pods and Replica Sets

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

Page 13: A Closer Look at Kubernetes Pods and Replica Sets

DemoScaling Replica Sets

Page 14: A Closer Look at Kubernetes Pods and 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

Page 15: A Closer Look at Kubernetes Pods and Replica Sets

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

Page 16: A Closer Look at Kubernetes Pods and Replica Sets

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