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
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
FDE という解 ― 暗黙知と明示知をつなぐ、伴走型エンジニアリング ―
otanet
0
100
AWSシリコン最前線 〜AI時代のチップ選択を読み解く〜
htokoyo
2
340
あなたの AI ワークスペースに、 専門コーダーを連れてくる - Amazon Quick Desktop 最新情報
kawaji_scratch
1
130
作って終わりにしない タイミーのセマンティックレイヤー育成の現在地
chanyou0311
3
2k
個人最適 から 全体最適 へ AI情報共有会・AIギルド・AI-DLC で進める カンリーの組織展開
rfdnxbro
0
2.1k
MCP Appsを作ってみよう
iwamot
PRO
4
360
2026 TECHFRESH 畢業分享會 - 開發日常大解密!從領域驅動到企業級上線
line_developers_tw
PRO
0
470
「嘘をつくテスト」の失敗例から学ぶ 良いテストコード #frontend_phpcon_do
asumikam
0
610
AIを「創る」と「使う」の循環 — HRテックが実践するリアルなAI組織実装
taketo957
0
1.9k
AIソロプレナー時代に2ヶ月で20人増員した事業創造会社の開発組織の話
miyatakoji
0
510
AI-DLCを活用した高品質・安全なAI駆動開発実践 / AI Driven Development with AI-DLC
yoshidashingo
0
160
新規事業を牽引する技術選定 〜フルスタックTypeScript開発の実践事例〜
nullnull
3
380
Featured
See All Featured
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
250
Producing Creativity
orderedlist
PRO
348
40k
Typedesign – Prime Four
hannesfritz
42
3.1k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
220
Designing Experiences People Love
moore
143
24k
YesSQL, Process and Tooling at Scale
rocio
174
15k
We Are The Robots
honzajavorek
0
240
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.4k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2k
Darren the Foodie - Storyboard
khoart
PRO
3
3.4k
Automating Front-end Workflow
addyosmani
1370
210k
Abbi's Birthday
coloredviolet
2
8k
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