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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
39
Keycloak を使った SSO で CockroachDB にログインする / CockroachDB SSO with Keycloak
kota2and3kan
0
280
Quarkus で FizzBuzz する CLI を作ってみた / FizzBuzz with Quarkus
kota2and3kan
0
65
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
690
分散トランザクション in CockroachDB / Distributed Tx in CockroachDB
kota2and3kan
1
2.3k
Resolving Tx Conflicts in CockroachDB ~Short Version~
kota2and3kan
0
270
Other Decks in Technology
See All in Technology
俺の仕事は AIに奪われないし、たぶんその BIも要らない
hikaruri
0
300
家のリアーキテクト・リファクタリング
suguruooki
0
140
range over func 2年間の軌跡 Issue #56413 はGoのエコシステムをどう変えたか
ryujicre8ive
0
130
HRC_Frontend_Conference_Fukuoka_2026.pdf
ts020
0
650
Screen Lens - 今見てる画面を翻訳する
komagata
0
260
Amazon Quick on DesktopがIAM Identity Centerで動かない理由
yukiogawa
0
180
Claude Code本って、 読む必要あるの?
oikon48
2
430
AIを活用するために決めた "やらないこと" - 価値に注目する / Not betting on AI
soudai
PRO
1
450
日経電子版を支えていく Kasane Design System/fec_fukuoka
nikkei_engineer_recruiting
0
1.2k
AIネイティブプロダクトで顧客価値を最大化するプロダクトエンジニアとFDEの協働
righttouch
PRO
0
270
Claude in Chrome 入門 / Introduction to Claude in Chrome
cielo1985
0
660
TinyGo 開発サイクルを高速化する:Go で作るエミュレータ入門
zozotech
PRO
1
680
Featured
See All Featured
Chasing Engaging Ingredients in Design
codingconduct
0
310
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
320
Music & Morning Musume
bryan
47
7.4k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
240
Design in an AI World
tapps
1
310
Building Applications with DynamoDB
mza
96
7.2k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
520
Navigating Weather and Climate Data
rabernat
0
520
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Writing Fast Ruby
sferik
630
63k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
660
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!