Kafka on Kubernetes: Does it Really Have to Be “The Hard Way”?

A presentation at Kafka Summit San Francisco 2019 in October 2019 in San Francisco, CA, USA by Viktor Gamov

Slide 1

Slide 1

Streaming on Kubernetes: Does it have to be the hard way? Fall, 2019 / San Francisco, Ca 2019 @gamussa @gamussa || #KafkaSummit #kafkasummit || @ConfluentINc @ConfluentINc

Slide 2

Slide 2

2 @gamussa | #KafkaSummit | @ConfluentINc

Slide 3

Slide 3

3 I build highly scalable Hello World apps @gamussa | #KafkaSummit | @ConfluentINc

Slide 4

Slide 4

4 Evolution of #devkafkaops Ansible Containers Cloud Scripts @gamussa | #KafkaSummit | @ConfluentINc

Slide 5

Slide 5

Slide 6

Slide 6

6 @gamussa | #KafkaSummit | @ConfluentINc

Slide 7

Slide 7

7 https://twitter.com/claesmogren/status/1108456688175079424 @gamussa | #KafkaSummit | @ConfluentINc

Slide 8

Slide 8

8 https://twitter.com/claesmogren/status/1108456688175079424 https://twitter.com/QuinnyPig/status/1150927901782499330 @gamussa | #KafkaSummit | @ConfluentINc

Slide 9

Slide 9

9 🙋 @gamussa | #KafkaSummit | @ConfluentINc

Slide 10

Slide 10

10 Who run stateless apps in Kubernetes? 🙋 Who thinks it’s a good idea? Who run stateful apps in Kubernetes? Who thinks it’s a good idea? @gamussa | #KafkaSummit | @ConfluentINc

Slide 11

Slide 11

11 #devkafkaops Well, it’s tricky © Translating an existing architecture to Kubernetes External access to brokers and other components Persistent Storage options on prem and clouds Security Configuration and Upgrades @gamussa | #KafkaSummit | @ConfluentINc

Slide 12

Slide 12

12 kafkaesque world of Kafka on Kubernetes @gamussa | #KafkaSummit | @ConfluentINc

Slide 13

Slide 13

13 Dude, you said «it doesn’t have to be hard way» @gamussa | #KafkaSummit | @ConfluentINc

Slide 14

Slide 14

14 @Micha8LNg @gamussa | #KafkaSummit | @ConfluentINc

Slide 15

Slide 15

DO KAFKA ON KUBERNETES DEMO AND EVERYONE LOOSES THEIR MINDS @gamussa | #KafkaSummit | @ConfluentINc 15

Slide 16

Slide 16

Tweet, yeah 🚀 Follow @gamussa @confluentinc 📸🖼%😂 Tag @gamussa With #KafkaSummit

Slide 17

Slide 17

17 Kubernetes Fundamentals @gamussa | #KafkaSummit | @ConfluentINc

Slide 18

Slide 18

18 @gamussa | #KafkaSummit | @ConfluentINc

Slide 19

Slide 19

19 Kubernetes ●Schedules and allocates resources ●Networking between Pods ●Storage ●Service Discovery @gamussa | #KafkaSummit | @ConfluentINc

Slide 20

Slide 20

20 Kubernetes Architecture kubectl https://thenewstack.io/kubernetes-an-overview/ @gamussa | #KafkaSummit | @ConfluentINc

Slide 21

Slide 21

21 @gamussa | #KafkaSummit | @ConfluentINc

Slide 22

Slide 22

22 Pod • Basic Unit of Deployment in Kubernetes • A collection of containers sharing: • Namespace • Network • Volumes @gamussa | #KafkaSummit | @ConfluentINc

Slide 23

Slide 23

23 Storage • Persistent Volume (PV) & Persistent Volume Claim (PVC) • PV is a piece of storage that is provisioned dynamic or static of any individual pod that uses the PV @gamussa | #KafkaSummit | @ConfluentINc

Slide 24

Slide 24

24 Kubernetes Storage classes Fast Slow Admin @gamussa | #KafkaSummit | @ConfluentINc

Slide 25

Slide 25

25 Kubernetes Storage classes Fast Slow Admin I feel the need for speed © Claim Developer @gamussa | #KafkaSummit | @ConfluentINc

Slide 26

Slide 26

26 Kubernetes Storage classes Fast Slow Admin Fast PV I feel the need for speed © Pod Claim Developer @gamussa | #KafkaSummit | @ConfluentINc

Slide 27

Slide 27

27 Kubernetes Storage classes Fast Slow Admin Fast PV I feel the need for speed © Pod Claim Claim Developer @gamussa | #KafkaSummit | @ConfluentINc

Slide 28

Slide 28

28 Provisioning storage in Kubernetes Kubernetes controller Storage System Kubernetes node @gamussa | #KafkaSummit | @ConfluentINc

Slide 29

Slide 29

29 Provisioning storage in Kubernetes The controller requests storage system to attach volume Kubernetes controller Storage System Kubernetes node @gamussa | #KafkaSummit | @ConfluentINc

Slide 30

Slide 30

30 Provisioning storage in Kubernetes The storage system attaches the volume Kubernetes controller Storage System Kubernetes node @gamussa | #KafkaSummit | @ConfluentINc

Slide 31

Slide 31

31 Provisioning storage in Kubernetes Kubelet requests storage system to mount Volume Kubernetes controller Storage System Kubernetes node @gamussa | #KafkaSummit | @ConfluentINc

Slide 32

Slide 32

32 Provisioning storage in Kubernetes Kubernetes controller Kubelet can now request container runtime to bind mount the volume into the requested path in the container. Storage System Kubernetes node /var/lib @gamussa | #KafkaSummit | @ConfluentINc

Slide 33

Slide 33

33 But I just want to deploy kafka @gamussa | #KafkaSummit | @ConfluentINc

Slide 34

Slide 34

Slide 35

Slide 35

35 Confluent Operator: Apache Kafka on Kubernetes made simple Confluent Platform Docker Images Run Apache Kafka and Confluent Confluent Operator Platform as a cloud-native application on Kubernetes to minimize operating complexity and Kubernetes AWS Azure GCP RH OpenShift Mesosphere Pivotal increase developer agility On-Premises @gamussa | #KafkaSummit | @ConfluentINc Cloud

Slide 36

Slide 36

Custom resource controller

Slide 37

Slide 37

37 a custom Kubernetes controller PODS API Server StatefulSets Scheduler PVs Custom Resources Master Node Worker Node | #KafkaSummit Applications run on Kubernetes ● Applications use objects like StatefulSets, Configmaps, PVs ● Custom Controllers create custom resources that provide unique application functionality: ConfigMaps Controllers & Custom Controllers @gamussa ● Nodes and pods are where | @ConfluentINc ○ Upgrades, elasticity, Kafka Operational Logic

Slide 38

Slide 38

38 @gamussa | #KafkaSummit | @ConfluentINc

Slide 39

Slide 39

39 Workloads Deployment @gamussa | #KafkaSummit | @ConfluentINc

Slide 40

Slide 40

40 Usual suspects Certified container images @gamussa Operator Helm Charts | #KafkaSummit | @ConfluentINc

Slide 41

Slide 41

Slide 42

Slide 42

Rolling Upgrade Kafka Broker Upgrades: 1. Stop the broker, upgrade Kafka 2. Wait for Partition Leader reassignment 3. Start the upgraded broker 4. Wait for zero under-replicated partitions 5. Upgrade the next broker

Slide 43

Slide 43

43 Will it Scale Spin up new brokers, connect workers easily Manual Rebalance required in v1.0 Determine balancing plan Execute balancing plan Monitor Resources @gamussa | #KafkaSummit | @ConfluentINc

Slide 44

Slide 44

44 One More Thing…

Slide 45

Slide 45

45 Usual suspects Certified container images @gamussa | #KafkaSummit | @ConfluentINc

Slide 46

Slide 46

46 Kotlin DSL for Kubernetes fun main() { val client = DefaultKafkaClient().inNamespace(“operator”) println(client.kafkaClusters().list()) client.kafkaClusters().create( newKafkaCluster { metadata { name = “kafka” } spec { replicas = 3 } } ) println(client.kafkaClusters().list()) } @gamussa | #KafkaSummit | @ConfluentINc

Slide 47

Slide 47

47 Kotlin DSL for Kubernetes fun main() { val client = DefaultKafkaClient().inNamespace(“operator”) println(client.kafkaClusters().list()) client.kafkaClusters().create( newKafkaCluster { metadata { name = “kafka” } spec { replicas = 3 } } ) println(client.kafkaClusters().list()) @gamussa | #KafkaSummit | @ConfluentINc }

Slide 48

Slide 48

48 @gamussa | #KafkaSummit | @ConfluentINc

Slide 49

Slide 49

Thanks! @gamussa viktor@confluent.io @Micha8LNg michael.ng@confluent.io https://slackpass.io/confluentcommunity #kubernetes @gamussa | @ #KafkaSummit | @ConfluentINc

Slide 50

Slide 50

50