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
Kubeshark で Kubernetes の Traffic を眺めてみよう/Let's ...
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
kota2and3kan
December 11, 2024
Technology
930
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
Keycloak を使った SSO で CockroachDB にログインする / CockroachDB SSO with Keycloak
kota2and3kan
0
230
Quarkus で FizzBuzz する CLI を作ってみた / FizzBuzz with Quarkus
kota2and3kan
0
53
CockroachDB Enterprise Features Overview
kota2and3kan
1
270
CockroachDB はどのくらい「しぶとい」のか? / How tough is CockroachDB?
kota2and3kan
21
13k
JRE しか入ってない Pod で Java の heap dump を取りたい / Get heap dump on JRE container
kota2and3kan
2
1.2k
Let's try CockroachDB
kota2and3kan
1
670
分散トランザクション in CockroachDB / Distributed Tx in CockroachDB
kota2and3kan
1
2.2k
Resolving Tx Conflicts in CockroachDB ~Short Version~
kota2and3kan
0
240
Resolving Tx Conflicts in CockroachDB
kota2and3kan
6
1.4k
Other Decks in Technology
See All in Technology
手塩にかけりゃいいってもんじゃない
ming_ayami
0
600
就職⽀援サービスにおけるキャリアアドバイザーのシフトスケジューリング
recruitengineers
PRO
1
150
[チョークトーク資料]AWS DevOps Agent を使いこなす / AWS Dev Ops Agent Chalk Talk AWS Summit Japan 2026
kinunori
1
200
脆弱性対応、どこで線を引くか
rymiyamoto
1
410
日本 Fintech 未来予測レポート 2027〜2028年(手動編集版)
8maki
0
2.4k
Bucharest Tech Week 2026 - Guardians of the Cloud-Native Galaxy
edeandrea
PRO
0
110
2026TECHFRESH畢業分享會 - Lightning Talk - 打造精準高效的 MCP 設計模式與測試實務
line_developers_tw
PRO
0
1.2k
新しいUbuntu/GNOMEが使いたいからXからWaylandへ移行頑張ってるの巻 2026-06-20
nobutomurata
0
140
Lightning近況報告
kozy4324
0
130
機械学習を「社会実装」するということ 2026年夏版 / Social Implementation of Machine Learning June 2026 Version
moepy_stats
6
2.4k
When Platform Engineering Meets GenAI
sucitw
0
100
マルチアカウント環境での コーディングエージェントを使った障害調査が大変なので AIエージェントにReadOnly権限を付与してみた / ReadOnly AI Agents for Multi-Account AWS Incident Response
yamaguchitk333
2
110
Featured
See All Featured
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
1.7k
How to Talk to Developers About Accessibility
jct
2
230
Accessibility Awareness
sabderemane
1
140
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
150
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
310
The Cost Of JavaScript in 2023
addyosmani
55
10k
Bash Introduction
62gerente
615
220k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
290
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
210
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
230
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
430
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!