Introduction to Kubernetes Containers container vs virtual machine - - PowerPoint PPT Presentation

introduction to kubernetes
SMART_READER_LITE
LIVE PREVIEW

Introduction to Kubernetes Containers container vs virtual machine - - PowerPoint PPT Presentation

Introduction to Kubernetes Containers container vs virtual machine Virtual machine Container runs its own kernel uses the host kernel user-space user-space vm user-space container user-space vm kernel host kernel host kernel


slide-1
SLIDE 1

Introduction to Kubernetes

slide-2
SLIDE 2

Containers

slide-3
SLIDE 3

container vs virtual machine

Virtual machine runs its own kernel Container uses the host kernel

host kernel user-space container user-space host kernel user-space vm kernel vm user-space

slide-4
SLIDE 4

containers are not secure

It is possible to execute code on a host system from a container

slide-5
SLIDE 5

containers are weird

Container operating system is a hybrid OS: it pairs arbitrary host kernel with arbitrary containerized user-space

slide-6
SLIDE 6

takeaways

  • Do not let unpriveleged users in
  • Do not rely on kernel or even system features

But since you will anyway, test containers with the production-like host kernel

slide-7
SLIDE 7

Docker

slide-8
SLIDE 8

layered images

FROM debian:jessie RUN apt-get update \ && apt-get install gradle \ && apt-get clean RUN apt-get update \ && apt-get install \ protobuf-compiler \ && apt-get clean

Dockerfjle reference

debian:jessie ..with gradle ..with protoc

slide-9
SLIDE 9

advanced topics

  • Volumes

You can mount directories from a host system into container Ownership and permissions on fjles are preserved => Problem with deleting fjles owned by root

  • Networking

You can connect port on the host system with the port exposed by container There is more, but “It’s complicated”

slide-10
SLIDE 10

Continuous Integration with containers

slide-11
SLIDE 11

containers for ci

At build

  • Take base image
  • Add build tools
  • Add dependency cache
  • Add git cache

Runtime

  • Update git cache
  • Run build task
  • Publish artifact to storage
  • Discard container

Git repo is a source, application is an artifact, contaner is a build tool

slide-12
SLIDE 12

containers for prod

At build

  • Take base image
  • Inject app artifact
  • Defjne endpoint

Runtime

  • Run container with

exposed endpoint Application is a source, container image is an artifact

slide-13
SLIDE 13

lifecycle

code JAR code docker image JAR GIT Bitbucket Maven repo Artifactory* Registry Nexus gradle build docker build

slide-14
SLIDE 14

Kubernetes

slide-15
SLIDE 15

There is a registry with Docker images now what?

slide-16
SLIDE 16
  • rchestration

Kubernetes is an open-source system for automating deployment, scaling, and management

  • f containerized applications
slide-17
SLIDE 17

vocabulary

  • Image
  • Container

runs image

  • Pod

group of containers

  • Node

host machine for pods

  • Cluster

set of nodes

Applies to group of pods:

  • Replica Set

replica counter

  • Deployment

deployment strategy

  • Service

common interface

slide-18
SLIDE 18

structure

cluster node pod

container

slide-19
SLIDE 19

deployment

service replica set

slide-20
SLIDE 20

kubernetes client tools

  • Kubernetes provides full-featured REST API
  • kubectl – command-line utility with full access to the API

Very verbose with a lot of subcommands and options Resources can be created and managed directly by typing CLI commands Or can be stored in YAML fjles and applied in batches by running $ kubectl create -f <directory>

  • kubernetes-dashboard – an optional plugin which provides graphical

web-interface with limited functionality

slide-21
SLIDE 21

networking

  • Every node has external IP address
  • Every pod has internal IP address

and domain name

  • Every service has internal IP address

and domain name => Pods can talk to pods and services by name or IP

192.168.42.152 192.168.42.154 10.123.15.21 pod-1.local 10.123.15.48 pod-2.local

slide-22
SLIDE 22

But how do I reach the pod from the outside?

slide-23
SLIDE 23

debugging pod

Pod with one container, based on “busybox” container image When started, runs shell and waits for input Works as a gate to internal network

(laptop)$ kubectl run -i --tty busybox --image=busybox --rm --restart=Never Waiting for pod default/busybox-kz38w to be running, status is Pending, pod ready: false Waiting for pod default/busybox-kz38w to be running, status is Pending, pod ready: false Hit enter for command prompt / # telnet pod-1.local 8080

slide-24
SLIDE 24

exposed service

NodePort – the same port on every node

  • Assigned to the service
  • Open for external network
  • Traffjc is redirected to one of

the pods behind the service

192.168.42.152 :9999 192.168.42.154 :9999

10.123.15.2 pod-1.local 10.123.15.3 pod-2.local

service

10.123.15.3 pod-3.local

slide-25
SLIDE 25

Demo

slide-26
SLIDE 26

q&a

Aleksandra Fedorova alpha@bookwar.info