35
Kubernetes on aws Yousun Jeong [email protected]

Kubernetes on aws

Embed Size (px)

Citation preview

Page 1: Kubernetes on aws

Kubernetes on awsYousun Jeong

[email protected]

Page 2: Kubernetes on aws

Agenda

• Docker

• Kubernetes

• Kubernetes on AWS

• Demo

Page 3: Kubernetes on aws

Docker

Automate the deployment of any application as a lightweight, portable, self-sufficient container

that will run virtually anywherehttps://www.docker.com/what-docker#Why-Should-I-Care-(For-Developers)

Page 4: Kubernetes on aws

Docker For Developers

Docker automates the repetitive tasks of setting up and configuring development environments so that developers

can focus on what matters: building great software.

Page 5: Kubernetes on aws

Docker for Ops

• Develop and deploy bug fixes and new features without roadblocks and scale applications in real time.

Page 6: Kubernetes on aws

Diff VM• Containers have similar resource isolation and

allocation benefits as virtual machines but a different architectural approach allows them to be much more portable and efficient.

Page 7: Kubernetes on aws

Docker Engine

• It uses a shared kernel and independent user mode sessions to provide isolated run-times for multiple applications on the same host.

Page 8: Kubernetes on aws

Docker Container

• It is a packaged application running in an isolated mode on a Docker host.

Page 9: Kubernetes on aws

Docker Client

• It provides a command line interface to control the Docker engine.

Page 10: Kubernetes on aws

Docker Image

• It is an application template ready to be deployed multiple times.

Page 11: Kubernetes on aws

Docker image

http://blog.octo.com/en/docker-registry-first-steps/

Page 12: Kubernetes on aws

Docker Architecture

http://southworks.com/blog/tag/docker/

Page 13: Kubernetes on aws

Docker Compose

• Docker Compose allows you to define your multi-container application with all of its dependencies in a single file, then spin your application up in a single command

Page 14: Kubernetes on aws

Docker Orchestration

https://www.linkedin.com/pulse/docker-redefining-cloud-computing-landscape-akash-goswami

Page 15: Kubernetes on aws

Kubernetes• Open Source Automation Framework for

deploying, managing, and scaling applications.

Page 16: Kubernetes on aws

Why Kubernetes

• Kubernetes provides a common API and self-healing framework which automatically handles machine failures and application deployments, logging, and monitoring.

Page 17: Kubernetes on aws

Kubernetes Concept• Clusters - set of compute, storage, network

resource

• Pods - colocated group of application containers that share volumes and a networking stack

• Replication Controllers - ensure a specific number of pods, manage pods, status updates

• Services - cluster wide service discovery

Page 18: Kubernetes on aws

Architecture

Page 19: Kubernetes on aws

Components

etcd flannel

kubernetes master

kubernetes node

kubernetes node

Page 20: Kubernetes on aws

kubectl• Pod

• Replication controller

• Deployment

• Service

• Volumes

https://kubernetes.io/docs/user-guide/deployments/

Page 21: Kubernetes on aws

Kubernetes on AWS

https://kubernetes.io/docs/getting-started-guides/aws/

Page 22: Kubernetes on aws

Kubernetes on AWSexport AWS_DEFAULT_PROFILE=default export KUBERNETES_PROVIDER=aws; wget -q -O - https://get.k8s.io | bash export AWS_ACCESS_KEY_ID=XXXX export AWS_SECRET_ACCESS_KEY=XXX export KUBERNETES_PROVIDER=aws export KUBE_AWS_ZONE=us-east-1c export NUM_NODES=3 export MASTER_SIZE=t2.medium export NODE_SIZE=m3.large export AWS_S3_REGION=us-east-1 export AWS_S3_BUCKET=XXX export INSTANCE_PREFIX=k8s export NODE_ROOT_DISK_SIZE=10 export MASTER_ROOT_DISK_SIZE=10 export AWS_SSH_KEY=/Users/dummy/.ssh/metatron

kube-up.sh

Page 23: Kubernetes on aws

Amazon Container Service

• Amazon ECS makes it easy to deploy, manage, and scale Docker containers running applications, services, and batch processes.

Page 24: Kubernetes on aws

Amazon Container Servie

http://docs.aws.amazon.com/AmazonECS/latest/developerguide/Welcome.html

Page 25: Kubernetes on aws

Amazon Container Servie

Page 26: Kubernetes on aws

Screenshot

Page 27: Kubernetes on aws

Screenshot

Page 28: Kubernetes on aws

Episode

• Pod restart

• Failed Containers that are restarted by the kubelet are restarted with an exponential back-off delay (10s, 20s, 40s …) capped at five minutes, and is reset after ten minutes of successful execution

Page 29: Kubernetes on aws

PersistentVolume• awsElasticBlockStore

kind: PersistentVolume apiVersion: v1 metadata: name: metatron-pv labels: type: amazonEBS spec: capacity: storage: 5Gi accessModes: - ReadWriteMany awsElasticBlockStore: volumeID: vol-XXXXXXXXXXXXXXXX fsType: ext4

Page 30: Kubernetes on aws

PersistentVolumeClaimkind: PersistentVolumeClaim apiVersion: v1 metadata: name: metatron-pvc labels: type: amazonEBS spec: accessModes: - ReadWriteOnce resources: requests: storage: 5Gi

Page 31: Kubernetes on aws

Deployment spec: volumes: - name: ebs-volume awsElasticBlockStore: volumeID: vol-XXXXXXXXXXXXXXXX fsType: ext4 containers: - name: jupyter image: jerryjung/jupyter-notebook-gfs:latest volumeMounts: - mountPath: "/home/jupyter/work" name: ebs-volume

Page 32: Kubernetes on aws

Kubernetes meets Hadoop• Persistent Volume Issue by permission

• Shared Nothing Architecture - hadoop

• DaemonSet or StatefulSet

for i in 0 1; do kubectl exec yarn-nm-$i -- sh -c 'hostname'; done yarn-nm-0 yarn-nm-1

Page 33: Kubernetes on aws

DEMO

Page 34: Kubernetes on aws

Q&A

Page 35: Kubernetes on aws

Thank you