Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Infrastructure Testing Using Kubernetes And Gol...
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Ran Tavory
May 06, 2019
Technology
120
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Infrastructure Testing Using Kubernetes And Golang
Ran Tavory
May 06, 2019
More Decks by Ran Tavory
See All by Ran Tavory
go-grpc-channelz: a Go based UI for gRPC's channelz
rantav
0
660
Code Review (Navy Hackathon)
rantav
0
120
Infrastructure testing using Kubernetes
rantav
0
600
Interview Workshop - Technical Questions
rantav
0
380
Code Review Best Practices
rantav
0
130
Code Review @ AppsFlyer
rantav
0
110
GraphQL at Yodas
rantav
2
190
Git for champs
rantav
0
180
Code Review at Yodas
rantav
0
210
Other Decks in Technology
See All in Technology
Claude Code×Terraform IaC テンプレート駆動開発
itouhi
1
470
ルールやカスタム機能、どう活かす?ハンズオンで体感するIBM Bobの出力コントロール
muehara
1
110
自律型AIエージェントは何を破壊するのか
kojira
0
130
Claude Code の Sandbox 機能を Anthropic Sandbox Runtime(srt) で試そう!/lets-play-anthropic-sandbox-runtime
tomoki10
1
460
データ基盤をDataformで整えた話 〜 開発環境を添えて 〜
takapy
0
140
新しいVibe Codingと”自走”について
watany
5
270
EventBridge Connection
_kensh
5
680
2026TECHFRESH畢業分享會 - 原生還是跨平台? App 開發踩坑實錄
line_developers_tw
PRO
0
430
AI駆動開発が変える、大規模開発の前提 ーHuman in the Loop から Human on the Loop へ / AIE2026
visional_engineering_and_design
30
23k
2026.06.13_AI時代に事業会社が「SIer出身エンジニア」を求める理由 / Why Businesses Seek Engineers with a System Integrator Background in the AI Era
jumtech
0
990
2026TECHFRESH畢業分享會 - Lightning Talk - 打造精準高效的 MCP 設計模式與測試實務
line_developers_tw
PRO
0
420
Dario Amodi『Policy on the AI Exponential』を理解する
nagatsu
0
210
Featured
See All Featured
WCS-LA-2024
lcolladotor
0
620
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
230
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
160
Paper Plane (Part 1)
katiecoart
PRO
0
8.8k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.5k
Designing Powerful Visuals for Engaging Learning
tmiket
1
410
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
390
30 Presentation Tips
portentint
PRO
1
320
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
840
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
380
Raft: Consensus for Rubyists
vanstee
141
7.5k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Transcript
Infrastructure testing using Kubernetes @rantav
OR: Testing Kafka replication over the Atlantic using Golang, Kubernetes
and friends
Hello! I am Ran Tavory I work on multi-region at
appsflyer You can find me @rantav (twitter/gmail/facebook) 3
The Goal: Test Kafka Replication ⊙ Replicate 30MB - 300MB
of traffic per second ⊙ Validate correctness ⊙ Measure latency ⊙ Run test cases (failure scenarios) ◦ Broker crash, cluster resize, packet loss... 4
Kafka ? Queueing System Stream Processing Brokers Partitions 5
HOW ? High level design 6
Kafka Replication From https://github.com/AppsFlyer/kafka-mirror-tester 7
With a home-grown producer and consumer written in golang 8
WHAT DO WE WANT? 9 DOCUMENTATION HOW DO WE DO
IT?
WHAT DO WE WANT? 10 REPRODUCIBILITY HOW DO WE DO
IT?
WHAT DO WE WANT? 11 MONITORING HOW DO WE DO
IT?
KUBERNETES 12
You keep saying this word Kubernetes What does it mean?
13
A brief introduction to Kubernetes 14
CLUSTER MANAGER Kubernetes is a 15
NODES The host running a kubelet and a set of
Pods 16 It manages
PODS Pods consist of 1 or more containers 17 Nodes
contain
DEPLOYMENTS A set of stateless pods 18 Pods run
STATEFUL SET A set of stateful pods 19 Pods also
run
KUBECTL The k8s CLI 20 You control k8s using
“
$ make k8s-all 22
What does that do? ⊙ Provision VMs in AWS ⊙
Setup VPCs, Subnets, Routing Tables ⊙ Create Security Groups ⊙ Setup Load Balancers ⊙ Install Kubernetes (etcd, masters, nodes) ⊙ Setup Monitoring (Prometheus & Grafana and install dashboard) ⊙ Install Weave Scope ⊙ Install Kafkas (and test them) ⊙ Install uReplicator (and test it) ⊙ Install test programs ⊙ And more… (ASGs, DHCP etc) 23
$ kops create cluster \ --zones us-east-1a,us-east-1b,us-east-1c \ --node-count 40
\ --node-size i3.large \ --master-size m4.large \ --master-zones us-east-1a \ --networking calico \ --cloud aws 24
What are we building? us-east-1 25 eu-west-1
What are we building? us-east-1 40 nodes k8s cluster 26
eu-west-1 48 nodes k8s cluster
What are we building? us-east-1 40 nodes k8s cluster 30
brokers kafka cluster 27 eu-west-1 48 nodes k8s cluster 30 brokers kafka cluster
What are we building? us-east-1 40 nodes k8s cluster 30
brokers kafka cluster 28 eu-west-1 48 nodes k8s cluster 30 brokers kafka cluster 8 workers uReplicator
What are we building? us-east-1 40 nodes k8s cluster 30
brokers kafka cluster 10 producers 29 eu-west-1 48 nodes k8s cluster 30 brokers kafka cluster 8 workers uReplicator 4 consumers
30 End Result
31 Grafana Dashboard
32 Prometheus
33 Weave Scope
34 Weave Scope
35 Weave Scope
36 kubectl example
TEST IT. Let’s put all this to test now 37
$ kubectl \ --context us-east-1.k8s.local \ -n kafka-source \ delete
pod kafka-source-2 38 KILL A BROKER
39 KILL A BROKER
$ kubectl \ --context us-east-1.k8s.local \ -n kafka-source \ scale
\ statefulset kafka-source \ --replicas 29 40 RESIZE KAFKA CLUSTER
41 RESIZE KAFKA CLUSTER
$ kubectl \ --context eu-west-1.k8s.local \ -n ureplicator \ scale
deployment \ ureplicator-worker \ --replicas 9 42 ADD uREPLICATOR WORKER
43 ADD uREPLICATOR WORKER
$ make k8s-redeploy-tests 44 ADD NEW TOPIC
45 ADD NEW TOPIC
$ make k8s-kafka-shell-source $ bin/kafka-topics.sh --zookeeper zookeeper:2181 --alter --topic topic5
--partitions 300 46 ADD PARTITIONS
$ kubectl --context eu-west-1.k8s.local \ -n ureplicator port-forward \ ureplicator-controller-76ff85b889-l9mzl
9000 $ curl -X DELETE http://localhost:9000/topics/topic5 $ curl -X POST -d \ '{"topic":"topic5", "numPartitions":"300"}' \ http://localhost:9000/topics 47 ADD PARTITIONS (cont)
48 PACKET LOSS
49 PACKET LOSS
CODE DEEP DIVE Golang Producer/Consumer (just a few bites) 50
51 Producer Main loop
52 Rate limit in Golang The classic gobyexample
53 Rate limit in Golang The classic gobyexample What is
the problem here?
54 Rate limit in Golang Solution: Use package rate
55 Rate limit in Golang Other solutions: Juju and Uber
56 Producer: using channels and the c library librdkafka p.ProduceChannel()
<- m
57 Consumer Main loop Loop select until: signaled || done.
Process event
58 Consumer Process message
“ Question: How can multiple consumers validate message arrival order?
59
60 Producer Sequence numbers messageKey = seq % partitions perKeySeq
= seq / partitions
CODE DEEP DIVE Kubernetes, head first (just a few bites)
61
62 Kafka kind: StatefulSet replicas: 30
Kafka Main container 63 image ports resources probes
64 Kafka config
65 Metrics sidecar container
66 Kafka anti- affinity
67 uReplicator deployment
68 Producer deployment
69 Consumer deployment
70 Service monitoring
$ make k8s-delete-all 71
72
Thanks! Any questions? You can find me at @rantav &
[email protected]
73 This presentation: https://speakerdeck.com/rantav/infrastructure-testing-using-kubernetes- and-go The project: https://github.com/AppsFlyer/kafka-mirror-tester