Slide 1

Slide 1 text

@k2r2bai TAI P E I 開 發 者交 流 之夜

Slide 2

Slide 2 text

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. @k2r2bai Vishwakarma: Terraform modules for deploying EKS and Self-hosting Kubernetes Kyle Bai Site Reliability Engineer AMIS Cloud Native Taiwan User Group

Slide 3

Slide 3 text

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. @k2r2bai About Me ⽩凱仁(Kyle Bai) • SRE at AMIS. • OSS Contributor. • Certified Kubernetes Administrator/Developer. • Co-organizer of Cloud Native Taiwan User Group. • Interested in emerging technologies. GitHub: kairen([email protected]) Blog: https://k2r2bai.com

Slide 4

Slide 4 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. • Motivations • Infrastructure as code • Vishwakarma • Live Demo Agenda Today I would like to talk about

Slide 5

Slide 5 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. Motivations

Slide 6

Slide 6 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. Data Centers Networking Servers Application Storage Virtualization OS Hardware Accelerator Drivers Database Runtime Application OS Data Centers Networking Servers Application Storage Virtualization OS Laptop Enterprise IT Public Cloud Customer Managed Provider Managed Database Runtime Database Runtime Drivers Drivers

Slide 7

Slide 7 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. Data Centers Networking Servers Application Storage Virtualization OS Hardware Accelerator Drivers Database Runtime Application OS Data Centers Networking Servers Application Storage Virtualization OS Laptop Enterprise IT Public Cloud Customer Managed Provider Managed Database Runtime Database Runtime Drivers Drivers

Slide 8

Slide 8 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. Data Centers Networking Servers Application Storage Virtualization OS Hardware Accelerator Drivers Database Runtime Application OS Data Centers Networking Servers Application Storage Virtualization OS Customer Managed Provider Managed Database Runtime Database Runtime Drivers Drivers Laptop Enterprise IT Public Cloud

Slide 9

Slide 9 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. Data Centers Networking Servers Application Storage Virtualization OS Hardware Accelerator Drivers Database Runtime Application OS Data Centers Networking Servers Application Storage Virtualization OS Laptop (Dev) Enterprise IT (Staging) Public Cloud (Production) Customer Managed Provider Managed Database Runtime Database Runtime Drivers Drivers

Slide 10

Slide 10 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. Dev Staging Production

Slide 11

Slide 11 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. Dev Staging Production US EU AP …

Slide 12

Slide 12 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. Dev Staging Production US EU AP …

Slide 13

Slide 13 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. TW Local Dev

Slide 14

Slide 14 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. TW Local Dev TW US Staging

Slide 15

Slide 15 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. TW Local Dev TW US Staging AP … US EU Production

Slide 16

Slide 16 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. Infrastructure as code

Slide 17

Slide 17 text

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. “Infrastructure-as-code (IaC) is the concept of writing code to represent your infrastructure requirements and using an IaC tool to apply those changes to your cloud/on-prem environment.”

Slide 18

Slide 18 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. • Create/change/destroy infrastructure resources such as compute, storage, networking components or platform services like database, Kubernetes cluster etc. • Deploy/update applications on top of the infrastructure. • Manage the configurations used by the applications. • Versioning infrastructure. The problems IaC tools can solve

Slide 19

Slide 19 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Slide 20

Slide 20 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Slide 21

Slide 21 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Slide 22

Slide 22 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. Terraform is the only tool to focus solely on creating, destroying and managing infrastructure components. You use the Hashicorp Configuration Language (HCL) to describe the infrastructure resources you need. • Provider • Provisioner • Modules • Plan phase • Apply phase Terraform

Slide 23

Slide 23 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. example

Slide 24

Slide 24 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Slide 25

Slide 25 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. CLI / SDK / Console Region A Region B Region C ... Terraform CLI Region A Region B Region C ...

Slide 26

Slide 26 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Slide 27

Slide 27 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. NGINX

Slide 28

Slide 28 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. Vishwakarma

Slide 29

Slide 29 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. Kubernetes solutions on AWS Kubespray RKE Kops Kube-aws Typhoon EKS CoreOS Tectonic LinuxKit Matchbox KubeNow Bootkube kubeadm-dind-cluster Minikube PKS Kubeadm KIND KRIB

Slide 30

Slide 30 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. Challenges to build Kubrnetes

Slide 31

Slide 31 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. • Maintain all AWS resources(ex: EC2 instance, VPC). • Kubernetes node(worker) scalability. • Kubernetes components upgrade. • Logging and Monitoring. • Configuration management. Challenges to build Kubrnetes on AWS

Slide 32

Slide 32 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. • Network environment customize. • Align company compliance. • Audit. • Security. • Topology. • ... • Cost. • Clusters have different topology. • Want more specific features. Why build Kubernetes by ourselves?

Slide 33

Slide 33 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. Vishwakarma can be used to create a Kubernetes cluster in AWS by leveraging HashiCorp Terraform and CoreOS. And there are two kind of Kubernetes master within vishwakarma, one leverages AWS EKS, the other one is ElastiKube (Self-Hosted). Vishwakarma hXps://github.com/getamis/vishwakarma

Slide 34

Slide 34 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. ElastiKube is a highly configurable Terraform module with building blocks. The motivation to build ElastiKube is that we need: • Robust and HA Kubernetes master nodes. • Pluggable HA worker nodes with different instance types. • Configurable Kubernetes resources during bootstrapping. • Standalone and HA etcd. • Use CoreOS Container Linux on all host machines. • Use Ignition for provisioning Container Linux. What's ElastiKube?

Slide 35

Slide 35 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Slide 36

Slide 36 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. • Agility: The ability to easily and atomically update software is the only way to improve internet security. • Portability: Containers turn apps into integral units that can migrate easily between machines and between providers. • Security: Today’s VM-focused workflow ties the OS directly to the apps on the box. Moving dependencies out of the OS and into a container dramatically reduces complexity. • Make sure that all resources are IMMUTABLE! Why do we use CoreOS?

Slide 37

Slide 37 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ignition is the utility used by CoreOS Container Linux, Fedora CoreOS, and RHEL CoreOS to manipulate disks during the initramfs. This includes partitioning disks, formatting partitions, writing files (regular files, systemd units, etc.), and configuring users. Ignition

Slide 38

Slide 38 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Slide 39

Slide 39 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. Live Demo

Slide 40

Slide 40 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. What’s Going On?

Slide 41

Slide 41 text

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. Self-hosting Kubernetes

Slide 42

Slide 42 text

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. Fargate for EKS

Slide 43

Slide 43 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Slide 44

Slide 44 text

@k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Slide 45

Slide 45 text

Thank you! @k2r2bai © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. Kyle Bai [email protected]