Skip to content

Commit

Permalink
[Hack Update] 023-AdvancedKubernetes - Incorporating changes to keep …
Browse files Browse the repository at this point in the history
…up-to-date with WTH standards (microsoft#288)

* Incorporating changes to keep up-to-date with WTH standards

* Publish slides

* Fix issues mentioned in microsoft#288

* fix slides to include images

* update slides
  • Loading branch information
lastcoolnameleft authored Jul 31, 2022
1 parent 77c5135 commit caf1711
Show file tree
Hide file tree
Showing 27 changed files with 775 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Challenge 1 - Setup
# Challenge 1: Coach's Guide - Setup

[Next Challenge>](./02-helm.md)
**[Home](README.md)** - [Next Challenge>](./02-helm.md)

## Instructions

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Challenge 2 - Helm
# Challenge 2: Coach's Guide - Helm

[< Previous Challenge](./01-setup.md)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Next Challenge>](./03-resiliency.md)
[< Previous Challenge](01-setup.md) - **[Home](README.md)** - [Next Challenge >](03-resiliency.md)

## Introduction

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Challenge 3 - Resiliency
# Challenge 3: Coach's Guide - Resiliency

[< Previous Challenge](./02-helm.md)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Next Challenge>](./04-scaling.md)
[< Previous Challenge](./02-helm.md) - **[Home](README.md)** - [Next Challenge>](./04-scaling.md)

## Introduction

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Challenge 4 - Scaling
# Challenge 4: Coach's Guide - Scaling

[< Previous Challenge](./03-resiliency.md)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Next Challenge>](./05-gitops.md)
[< Previous Challenge](./03-resiliency.md) - **[Home](README.md)** - [Next Challenge>](./05-gitops.md)

## Introduction

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Challenge 5: Coach's Guide - Gitops

[< Previous Challenge](./04-scaling.md) - **[Home](README.md)** - [Next Challenge>](./06-service-mesh.md)

Here are the steps to deploy Flux in your AKS cluster.

```bash
Expand Down
12 changes: 12 additions & 0 deletions 023-AdvancedKubernetes/Coach/06-service-mesh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Challenge 6: Coach's Guide - Service Mesh

[< Previous Challenge](05-gitops.md) - **[Home](README.md)** - [Next Challenge>](./07-data-volumes.md)

NOTE: Coaches steps for this challenge are intentionally not included.

This challenges is intended for the students to install and play with the different service meshes. Because each of the service meshes change over time, there's not much value to include steps which will be outdated.

Some common observations:
* Istio is feature complete, but almost overwhelming. It is built on Envoy which is pervasive in the Cloud Native ecosystem
* Linkerd is easy to use and get started.
* Consul is pretty good and has a lot of features.
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Challenge 7: Coach's Guide - Data Volumes

[< Previous Challenge](06-service-mesh.md) - **[Home](README.md)**

## Sub-challenge 1: Static provisioning with Azure Disks

### Provision an Azure Disk
Expand Down
26 changes: 26 additions & 0 deletions 023-AdvancedKubernetes/Coach/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# What The Hack - Advanced Kubernetes

## Introduction
Welcome to the coach's guide for the Advanced Kubernetes What The Hack. Here you will find links to specific guidance for coaches for each of the challenges.

Also remember that this hack includes a optional [presentation](slides.html) that features short presentations to introduce key topics associated with each challenge. It is recommended that the host present each short presentation before attendees kick off that challenge.

Other optional presentations imported into this repo, but not specifically designed for this WTH, include:
* [Container Probes](Lectures/Container%20Probes.pptx)
* [Helm Intro](Lectures/Helm%20Intro.pptx)

## Coach's Guides
- Challenge 1: **[Setup](01-setup.md)**
- Tools and prerequisites for getting started
- Challenge 2: **[Helm](02-helm.md)**
- Create, deploy and modify new and existing Helm charts
- Challenge 3: **[Resiliency](03-resiliency.md)**
- Recovery quickly from issues
- Challenge 4: **[Scaling](04-scaling.md)**
- HPA, Cluster Scaling, Requests and Limits
- Challenge 5: **[Gitops](05-gitops.md)**
- Deploy flux and sync it to your K8S cluster
- Challenge 6: **[Service Mesh](06-service-mesh.md)**
- Pick and choose between the different serice meshes and understand the differences
- Challenge 7: **[Data Volume](07-data-volumes.md)**
- Learn the different ways to store state inside K8S
Binary file added 023-AdvancedKubernetes/Coach/img/bc-dr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
423 changes: 423 additions & 0 deletions 023-AdvancedKubernetes/Coach/slides.html

Large diffs are not rendered by default.

296 changes: 296 additions & 0 deletions 023-AdvancedKubernetes/Coach/slides.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,296 @@
---
marp: true
theme: default
_class: invert
paginate: true
---


# **WTH - Advanced Kubernetes**

Tommy Falgout - US OCP CSA

---

# Agenda

* Introductions
* WTH is WTH?
* Data Volumes Walkthrought
- Key Concepts
- Demo
* Q&A

---

# Introduction

- Choose-Your-Own-Adventure WTH
- Multiple, individual challenges
- Pick the ones you’re interested in

---

# Objectives

- Create and deploy Helm charts
- Build resiliency into your pods
- Scale your cluster
- Use Git as the Source of Truth for your cluster
- Learn about the features of a Service Mesh
- Bring data into your web application

---

# Prerequisites

Before starting this hack you should have hands-on experience with the following:
- AKS
- Kubernetes Ingress
- Github (Repo, Cloning)
- Docker Hub

---

# Challenge #1 - Setup

- Only required challenge
- Key Concepts
- Azure CLI
- Docker / Helm
- Github / Dockerhub / ACR
- AKS / ACR
- curl / jq
- kubectx / kubens / kube-aliases
- You will:
- Create your AKS Cluster
- Install tools used in other challenges

---

# Challenge #2 - Helm

- Helm is the package manager for Kubernetes
- Key Concepts
- Helm Chart
- Helm Release
- Ingress / Ingress Controller
- You will:
- Create a Helm chart
- Deploy a Helm release

---

# Challenge #3 - Resiliency

- Processes fail. Will your system too?
- Key Concepts
- Liveness Probe
- Readiness Probe
- You will:
- Run multiple replicas of a pod
- Enable the Liveness Probe
- Enable the Readiness Probe

---

# Challenge #4 - Scaling

- Learn how to scale as well as when to scale
- Key Concepts
- Horizontal Pod Autoscaler
- Cluster Scaling
- Requests / Limits
- You will:
- Scale the pods (app)
- Scale the cluster (VM)
- Learn Requests and Limits

---

# Challenge #5 - GitOps

- Car drifting is cool. Configuration drifting isn’t.
- Key Concepts
- Kubernetes Operator
- Flux
- You will:
- Learn principles behind GitOps
- Install Flux
- Update your cluster via a change on GitHub

---

# Challenge #6 – Service Mesh

- Service Meshes provide more control and insight into your cluster
- At a cost
- Key Concepts
- Mutual TLS (mTLS)
- Distributed Tracing
- Envoy
- You will:
- Review the different Service Meshes
- Install Istio, Linkerd, and/or Consul
- Enable some of the basic functionality of each

---

# Challenge #6 – Service Mesh - Comparison

| Name | Uses | Supported by | Platform | Complexity |
| --- | --- | --- | --- | --- |
| Istio | Envoy | Google | K8S + VM | Heavy |
| Linkerd | Text | Buoyant | K8S Only | Light |
| Consul | Text | Hashicorp | K8S + VM | Medium |

---

# Challenge #7 – Data Volumes

Used when your application runs in a container, but still needs access to local files

Key Concepts:
- Persistent Volumes / Persistent Volume Claims
- Access Modes
- Storage Class

You will:
- Deploy a sample app which stores state
- The app writes to a file every second with a timestamp. Web requests to the app returns the file contents
- Terminate the app to see how it responds to failure

---

# Challenge #7 – Data Volumes – Key Concepts

Storage Class (SC) – Defines a storage profile
- e.g. Azure Managed Disk with Standard_LRS in EastUS

Persistent Volume Claims (PVC) – A request for storage using a SC
- e.g. 1 GB Disk using the above SC

Persistent Volumes (PV)– Instance of storage
- e.g. `/subscriptions/df8428d4-bc25-4601-b458-1c8533ceec0b/resourceGroups/mc_sandbox_sandbox_eastus2 /providers/Microsoft.Compute/disks/kubernetes-dynamic-pvc-593afd0e-4af4-49b5-a145-26a7bcd39a3e`

---

# Challenge #7 – Data Volumes – Key Concepts

Access Modes – The permission for the volumes

- ReadWriteOnce (RWO) - The volume can be mounted as read-write by a single node
- Supported: Azure Disk, Azure Files
- ReadOnlyMany (ROX) - The volume can be mounted read-only by many nodes
- Supported: Azure Files
- ReadWriteMany (RWX) - The volume can be mounted as read-write by many nodes
- Supported: Azure Files

---

![bg fit](../Student/img/aks-volumes.png)

---

# Challenge #7 – Data Volumes – Gotchas

Availability Zones
- Volumes that use Azure managed disks are currently not zone-redundant resources.
- Volumes cannot be attached across zones and must be co-located in the same zone as a given node hosting the target pod.

Know your IOPS requirements
- Azure Files is slower than Azure Disk

---

# Challenge #7 – Data Volumes – Pop Quiz

- Which of these storage solutions would you choose for:
- Relational DB Instance? (e.g. MySQL)
- API which saves files on shared directory for permanent storage?
- API which saves files for temp storage?

---

# Challenge #8 – BC/DR

![](img/bc-dr.png)

---

# Challenge #8 – BC/DR (Key Concepts)

Availability Set
- Logical group of VM's across Fault Domain (rack) and Update Domain (OS)
- e.g. VMSS or VMAS

Availability Zone (AZ)
- Physical zone (distinct power source, network, cooling)
- e.g. Zone 1 in West US

Region
- Group of Datacenters
- e.g. West-US

---

# Challenge #8 – BC/DR (Key Concepts)

Service Level Objectives (SLO)
- Internal goals
- More stringent
- Target for service Metric
- e.g. 99% of requests will be completed in 5ms

---

<style scoped>
table {
height: 100%;
width: 100%;
font-size: 20px;
}
th {
color: blue;
}
</style>

# Challenge #8 – BC/DR (Key Concepts)

| Availability % | Downtime per year | Downtime per quarter | Downtime per month | Downtime per week | Downtime per day |
| --- | --- | --- | --- | --- | --- |
| 99% ("two nines") | 3.65 days | 21.9 hours | 7.31 hours | 1.68 hours | 14.40 minutes
| 99.5% ("two and a half nines") | 1.83 days | 10.98 hours | 3.65 hours | 50.40 minutes | 7.20 minutes |
| 99.9% ("three nines") | 8.77 hours | 2.19 hours | 43.83 minutes | 10.08 minutes | 1.44 minutes |
| 99.95% ("three and a half nines") | 4.38 hours | 65.7 minutes | 21.92 minutes | 5.04 minutes | 43.20 seconds |
| 99.99% ("four nines") | 52.60 minutes | 13.15 minutes | 4.38 minutes | 1.01 minutes | 8.64 seconds |
| 99.999% ("five nines") | 5.26 minutes | 1.31 minutes | 26.30 seconds | 6.05 seconds | 864.00 milliseconds

---

# Challenge #8 – BC/DR (Key Concepts)


High Availability (HA)
- Maintain acceptable performance despite service, hardware or DC failure
- e.g. VM Scale Set, Availability Zones

Business Continuity / Disaster Recovery (BC/DR)
- Protect against loss of an entire region
- e.g. South Central US goes down

Backup and Restore
- Replicate data to 1+ regions
- e.g. Azure Backup

---

# Challenge #8 – BC/DR (Stateless)

You will:
- Create 2 AKS clusters (east-us, west-us)
- Deploy a sample stateless app + service with Public IP
- Deploy a Traffic Manager instance
- Watch traffic go from one primary region to backup


2 changes: 2 additions & 0 deletions 023-AdvancedKubernetes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

This hack will guide you through advanced Kubernetes topics for both Operators and Developers. These challenges are taken from what we are seeing in the field.

Unlike other WhatTheHack's, each of the challenges here are independent (e.g. You can do GitOps challenges without having done the Scaling challenges). This is by design as different teams can prioritize specific features of Kubernetes.

## Learning Objectives

In this hack, you will be working on a set of "Day 2" operational best practices for Kubernetes cluster management. You will learn:
Expand Down

0 comments on commit caf1711

Please sign in to comment.