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
610
Interview Workshop - Technical Questions
rantav
0
380
Code Review Best Practices
rantav
0
130
Code Review @ AppsFlyer
rantav
0
120
GraphQL at Yodas
rantav
2
190
Git for champs
rantav
0
180
Code Review at Yodas
rantav
0
220
Other Decks in Technology
See All in Technology
Text-to-SQLをAgentCoreで実現し、生成されるSQLの精度を定量的に評価する
yakumo
2
770
しぶいSRE: サーバから見えない障害にどう向き合うか。ラストワンマイルのデバッグ実践 / Shibui SRE
kanny
13
5.8k
人を動かすのは時間ではなく、納得感 〜新任EMが入社3ヶ月、組織を2回変えた話〜
kakehashi
PRO
3
200
AI Driven AI Governance
pict3
0
320
AIと共生する開発者プラットフォーム:バクラクのモノレポ×マイクロサービス基盤
sakajunquality
2
3.2k
勉強会企画をアプリで構造化してみた 〜そこで見えた、AIとの付き合い方〜 / I've structured a study group plan using an app.
pauli
0
340
生成AIの活用/high_school2026
okana2ki
0
120
SREとQA 二人三脚で進めるSLO運用/sre-qa-slo
sugitak
0
270
アカウントが増えてからでは遅い? ~ マルチアカウント統制の勘所 ~
kenichinakamura
0
220
テスト設計の本質を改めて考えてみる~生成AIを活用する時代だからこそ、作ったテストの説明性を高めよう~
yamasaki696
1
450
完全自律ロボットを作りたくて、先に開発を自律させた話(ROS Japan UG #63 LT)
rryz09
0
440
FinOps X 2026 Recap from Engineer Side #JapanFinOps
chacco38
0
270
Featured
See All Featured
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.7k
First, design no harm
axbom
PRO
2
1.2k
Odyssey Design
rkendrick25
PRO
2
730
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.6k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
180
Claude Code のすすめ
schroneko
67
230k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
400
30 Presentation Tips
portentint
PRO
1
340
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
230
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