Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Kubeshark で Kubernetes の Traffic を眺めてみよう/Let's ...
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
kota2and3kan
December 11, 2024
Technology
980
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Kubeshark で Kubernetes の Traffic を眺めてみよう/Let's Look at k8s Traffic with Kubeshark
kota2and3kan
December 11, 2024
More Decks by kota2and3kan
See All by kota2and3kan
Lakehouse を Kubernetes 上に作ってみる / Lakehouse on Kubernetes
kota2and3kan
0
43
Keycloak を使った SSO で CockroachDB にログインする / CockroachDB SSO with Keycloak
kota2and3kan
0
290
Quarkus で FizzBuzz する CLI を作ってみた / FizzBuzz with Quarkus
kota2and3kan
0
73
CockroachDB Enterprise Features Overview
kota2and3kan
1
290
CockroachDB はどのくらい「しぶとい」のか? / How tough is CockroachDB?
kota2and3kan
21
13k
JRE しか入ってない Pod で Java の heap dump を取りたい / Get heap dump on JRE container
kota2and3kan
2
1.3k
Let's try CockroachDB
kota2and3kan
1
700
分散トランザクション in CockroachDB / Distributed Tx in CockroachDB
kota2and3kan
1
2.3k
Resolving Tx Conflicts in CockroachDB ~Short Version~
kota2and3kan
0
280
Other Decks in Technology
See All in Technology
GitHub Agentic Workflows を触ってみる
htkym
2
900
AWS FinOps Agent 結局何が得意なの?
siromi
0
230
Harness Engineering on Rails
joelq
0
770
猫でもわかるKiro Web
kentapapa
1
160
セルフサービスのオブザーバビリティ基盤をOpenTelemetryで作る / Building a Self-Service Observability Platform with OpenTelemetry
ymotongpoo
3
500
KanaAI
shreyas1009
0
140
検証フェーズはAIの回答を判断するための学習機会
toru_kubota
2
140
Snowflake Horizon Catalog と Apache Iceberg で作る オープンなデータ基盤
kitagawaz
0
360
PQC移行の今 -- IETF からみた現在地
satokan
4
710
生成AIを使って「人が」考える技術 ― AI時代の人機共想と実践ノウハウ|UNITT AC2026
ishiirikie
0
490
[2026-09-30]ロックンロールは鳴り止まないっ - 信頼性かまってちゃん - 「データ駆動を投げ捨ててまで。」追いかける信頼性改善に向けた取り組みの話
tosite
0
110
Databricksメトリクスビューはじめてのもくもく会
taka_aki
0
150
Featured
See All Featured
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.6k
First, design no harm
axbom
PRO
2
1.3k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
340
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
203
76k
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
Claude Code のすすめ
schroneko
67
230k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.4k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.6k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.1k
Transcript
2024/12/11 Oracle Cloud Hangout Cafe Season 9 #3 Kubeshark で
Kubernetes の Traffic を眺めてみよう #ochacafe
Name: こたつ&&みかん Account: @kota2and3kan Company: Name: Scalar, Inc. Product: -
ScalarDB (Distributed Transaction Manager) - ScalarDL (Byzantine Fault Detection Middleware) Job: [Technical Support, Infra Engineer] Like: DB: [PostgreSQL, CockroachDB] Bouldering: 5Q Dislike: Real Cockroach Who am I.
今日は Kubeshark のお話をします
Kubeshark Overview
Kubeshark Overview • Network Observability for Kubernetes ◦ Kubernetes Cluster
内の Traffic を監視できるツール。 ◦ TCP, UDP, HTTP, DNS, gRPC, Redis, Kafka 等の様々なプロトコルに対 応。 ◦ Kubernetes 用の Wireshark 的なもの。 ◦ Kubernetes の metadata (Pod 名や Namespace 名等) を利用した柔軟な filtering ができる。 • 公式サイト ◦ https://www.kubeshark.co/ • 公式ドキュメント ◦ https://docs.kubeshark.co/en/introduction • GitHub ◦ https://github.com/kubeshark/kubeshark
Kubeshark Overview • いい感じの Dashboard (Web UI) が提供されており、Kubernetes Cluster 内の
Traffic の情報をいい感じに参照できる。
• 4 Node の Kubernetes Cluster までなら Free でつかえる。 ◦
https://www.kubeshark.co/pricing ◦ https://docs.kubeshark.co/en/license Kubeshark Overview
• Sharky というマスコットがいる。かわいい。 ◦ https://docs.kubeshark.co/en/mascot Kubeshark Overview
Install
Install • Install (Kubernetes 上への deploy) 方法は 2つある。 ◦ kubeshark
tap (CLI) ◦ Helm Chart $ kubeshark tap $ helm repo add kubeshark https://helm.kubeshark.co $ helm install kubeshark kubeshark/kubeshark
Install • Deploy するといくつかの Pod が起動する。 $ kubectl get pod
NAME READY STATUS RESTARTS AGE kubeshark-front-75f798fbd-27w4c 1/1 Running 0 70m kubeshark-hub-79b98b497c-cmb8z 1/1 Running 0 70m kubeshark-worker-daemon-set-vfdc8 1/1 Running 0 70m
Demo
Demo • Workload の Sample として以下の 3つを deploy。 ◦ Guestbook
▪ https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook ◦ Bookinfo ▪ https://github.com/digitalocean/kubernetes-sample-apps/tree/master/ bookinfo-example ◦ etcd ▪ https://etcd.io/docs/v3.5/op-guide/kubernetes/
Demo • Guestbook $ kubectl get pod -n guestbook NAME
READY STATUS RESTARTS AGE frontend-6b5f4cf68c-djzqp 1/1 Running 0 13m redis-follower-6d7fccb64f-prmrp 1/1 Running 0 13m redis-follower-6d7fccb64f-x4hdp 1/1 Running 0 13m redis-leader-57f98b4cfd-d66zg 1/1 Running 0 13m
Demo • Bookinfo $ kubectl get pod -n bookinfo NAME
READY STATUS RESTARTS AGE details-v1-848ff745bf-s8zks 1/1 Running 0 11m productpage-v1-fffc79d49-6ccxw 1/1 Running 0 11m ratings-v1-7fcb6784b9-52bkm 1/1 Running 0 11m reviews-v1-59cfbf87cf-r4m78 1/1 Running 0 11m reviews-v2-587ddf67d9-fx9c6 1/1 Running 0 11m reviews-v3-7f67685b4c-d27m9 1/1 Running 0 11m
Demo • etcd $ kubectl get pod -n etcd NAME
READY STATUS RESTARTS AGE etcd-0 1/1 Running 0 43m etcd-1 1/1 Running 0 43m etcd-2 1/1 Running 0 43m
Demo (DNS request / A record)
Demo (DNS response / A record)
Demo (gRPC request / etcd Range API)
Demo (gRPC response / etcd Range API)
Demo (HTTP request / Readiness probe)
Demo (HTTP response / Readiness probe)
Demo (Redis request / GET)
Demo (Redis response / GET)
Demo (Service Map)
Demo (Filtering / Exclude DNS)
Demo (Filtering / “etcd” namespace only)
Demo (Automation / Alert 404 responses) • JavaScript を使って、packet や
request / response の内容に応じた処理を独自 に実装することができる。 • 例えば、以下のような Script を登録すると、HTTP response の Status Code が 404 だった場合に Dashboard 上の表示を「赤」に、それ以外は「緑」にすることが できる。 function onItemQueried(data) { if (data.response.status === 404) return test.fail(data); else return test.pass(data); }
Demo (Automation / Alert 404 responses)
Demo (Automation / Alert 404 responses)
Demo (Automation / Log 404 error to console) • JavaScript
を使って、packet や request / response の内容に応じた処理を独自 に実装することができる。 • 例えば、以下のような Script を登録すると、HTTP response の Status Code が 404 だった場合に、Console に任意の Log を出力することができる。 function onItemCaptured(data) { if (data.response.status === 404) { console.log("404 occurred. Request path:", data.request.path) } }
Demo (Automation / Log 404 error to console)
Demo (Automation / Log 404 error to console)
Demo (Automation / Log 404 error to console) • kubeshark
console コマンドを利用すると、CLI (Termial) 上でも console に出力さ れる Log を確認できる。 $ kubeshark console 2024-12-08T19:26:53+09:00 INF console.go:45 > Starting scripting console ... 2024-12-08T19:26:58+09:00 INF console.go:61 > Connecting to: host=127.0.0.1 url=http://127.0.0.1:8899/api [minikube-1] 404 occurred. Request path: /wrong/path [minikube-1] 404 occurred. Request path: /wrong/path/baz [minikube-1] 404 occurred. Request path: /wrong/path/foo [minikube-1] 404 occurred. Request path: /wrong/path/bar
Other Features
Other Features • JavaScript を使った Automation では、外部のサービスとの連携もできる。 ◦ Prometheus 用の
custom metrics (packet の情報を含む metrics) を export する。 ◦ 特定の条件に合致した request を検知した場合は、その情報を Slack に通知 する。 ◦ 特定の条件に合致した packet を含む packet capture (.pcap ファイル) を S3 や GCS に保存する。 ◦ 特定の条件に合致した packet の情報を Elasticsearch や InfluxDB に送信 する。 ◦ 特定の条件に合致する packet を検出した場合、任意の Webhook を実行す る。 ◦ etc… ◦ https://docs.kubeshark.co/en/automation_introduction
Other Features • TLS で暗号化された Traffic の中身も見れる (らしい / 今回は未検証)。
◦ eBPF を使って以下の処理を hook し、いい感じに処理しているらしい。 ▪ OpenSSL の SSL_read() および SSL_write()。 ▪ Go 言語の crypto/tls.(*Conn).Read および crypto/tls.(*Conn).Write。 ▪ 上記以外の library 等を使って暗号化された packet の内容は参照でき ないのではないかと思われる (未検証)。 ◦ https://docs.kubeshark.co/en/encrypted_traffic
まとめ
まとめ • Kubeshark を使うと Kubernetes Cluster 内の Traffic をいい感じに監視/可視化で きる。
• いい感じの Dashboard があり、視覚的に Kubernetes Cluster 内の Traffic を表 示してくれる。 • マスコットがかわいい。 • JavaScript で独自の処理を実装し、Traffic の監視や他のサービスとの連携ができ る。 • Node 数が 4 までの Kubernetes Cluster であれば Free で使えるので、ちょっとし た検証等には便利だと思われる。 • サメ。
宣伝
Database Engineering Meetup をやってます!!! https://scalar.connpass.com/ 次回は KubeDay Japan Revisit (日本語
recap) です!!!
Thank you!