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
Knativeを使うと何が嬉しいの?
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
小野佑大
June 24, 2023
Technology
680
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Knativeを使うと何が嬉しいの?
2023.06.24 インフラ技術基礎勉強会#3
小野佑大
June 24, 2023
More Decks by 小野佑大
See All by 小野佑大
分断された OT と IT を繋ぐ架け橋 -Kubernetes が切り拓く 産業用組み込み製品の現在地 -
yudaiono
1
160
クラウドネイティブがもたらす組み込み開発のパラダイム
yudaiono
0
270
製造DXを加速するIT/OT融合プラットフォーム
yudaiono
0
310
組み込み開発でクラウドネイティブを始める方法
yudaiono
1
240
30分で分かるKnative実践ガイド
yudaiono
1
280
リアルとバーチャルを繋ぐエッジネットワーキング動向
yudaiono
1
390
SAS Viyaの基盤にOpenShiftが最適の理由
yudaiono
0
840
オープンソースから見るエッジコンピューティングの現在と未来
yudaiono
0
310
エッジデバイスでKubernetesが期待される3つの理由
yudaiono
0
440
Other Decks in Technology
See All in Technology
失敗を経て、Harness Engineering で 大切にしたいことを考える / Learning from Failure: What Matters in Harness Engineering
bitkey
PRO
1
370
作って終わりにしない タイミーのセマンティックレイヤー育成の現在地
chanyou0311
4
2.4k
日本 Fintech 未来予測レポート 2027〜2028年(手動編集版)
8maki
0
2.3k
現地で盛り上がった WWDC26 Keynote
zozotech
PRO
1
250
MCP Appsを作ってみよう
iwamot
PRO
4
640
RSA暗号を手計算したくなること、ありますよね?? (20260615_orestudy6_rsa)
thousanda
0
410
AIネイティブな開発のサプライチェーンリスク対策 〜激動の開発現場でリスクに立ち向かう〜【ZennFes】
cscengineer
PRO
2
130
エラーバジェットのアラートのタイミングを考える.pdf
kairim0
0
150
【NRUG vol.18】KubernetesにおけるNew Relicデータ取得量削減の考え方
nrug_member
0
120
SONiCのLinuxベースを活かしたZabbix監視
sonic
0
160
フロンティアAIのゲート化と地政学リスク
nagatsu
0
140
Chainlitで作るお手軽チャットUI
ynt0485
0
240
Featured
See All Featured
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
SEO for Brand Visibility & Recognition
aleyda
0
4.6k
Become a Pro
speakerdeck
PRO
31
6k
Navigating Team Friction
lara
192
16k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
840
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
360
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
330
Raft: Consensus for Rubyists
vanstee
141
7.5k
The Limits of Empathy - UXLibs8
cassininazir
1
360
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
280
Faster Mobile Websites
deanohume
310
31k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
610
Transcript
Knativeを使うと何が嬉しいの? Yudai Ono
レッドハット株式会社 OpenShiftのソリューションアーキテクト エッジコンピューティング 所属 小野 佑大 @pinkink_yudai 2 自己紹介
役割 出版
SERVING K8sへのアプリのデプロイの抽象化 (APIの簡単デプロイ) EVENTING アプリの非同期連携を抽象化 (簡単データ連携) Knativeは、アプリ開発チームがKubernetesを簡単に使えるようにするために Kubernetesを「抽象化する」APIを提供するソフトウェアです。 3 What
is Knative ?
Knative Serving Service Route Revision Configuration Ingress Ingress Controller Ingress
Gateway 各Revisionへのトラフィック振り 分けルール Revisionの管理 Ingress設定 Serviceの更新毎に新規作成 Knative ServiceのAPIを使ってアプリをデプロイすると アクセス先のURLが返る(アプリデプロイの手順の簡素化) HTTPS K8s Service K8s Pod Deployment Kubernetes を抽象化 $ kn service create app --image app:latest … https://xxx 4
Route Activator Pod Revision K8s Deployment Pod Queue Proxy User
app AutoScaler Reconciler Serverless Service Reconciler Replicasを調整 メトリクス報告 Serveモード切り替え Endpointを動的に変更しトラフィックパスへの Activatorの挿入・削除を制御 メトリクス報告 通常時の経路 (Serve Mode = Serve) Podが0台の時の経路 (Serve Mode = Proxy) HTTPリクエストをキューイング HTTPリクエスト 5 Knative Servingのネットワーキング Knative ServingはHTTPリクエストを自身のコンポーネントでキューイングし、 HTTPリクエストに基づくオートスケールをデフォルト適用する。( PodのHTTP負荷の隠蔽)
apiVersion: eventing.knative.dev/v1 kind: Trigger metadata: name: kafka-to-trigger spec: broker: kafka-broker
filter: attributes: Source: sample subscriber: ref: apiVersion: serving.knative.dev/v1 kind: Service name: sample-app-py 対象イベントを特定 Knative EventingがイベントをHTTP POST Broker Trigger filter A Source Knative Service Trigger filter B Source Event Source Knative Service HTTPリクエストを受信して起動 6 Knative Eventing Kafka等の外部システムで管理される「イベント」を アプリへルー ティングすることで、アプリ間の非同期連携を実装 Event Source連携を抽象化
Knative Eventingを用いた非同期連携 # イベントを受信し、在庫情報を更新する @app.route("/", methods=["POST"]) def receive_cloudevents(): # ①イベントを受信する
event = json.loads( request.data ) # ②処理ロジック foo = bar(...) # ③HTTPレスポンスのヘッダをCloudEvents形式とすると、 # Knative Eventingがイベントの発生と判断してくれる … response = make_response( json.dumps(value).encode('utf-8') ) response.headers["Ce-Id"] = str(uuid.uuid4()) response.headers["Ce-Source"] = "dev.knative.serving#stock" … return response, status_code ①受信 Kafka ②Logic アプリA Knative Eventing Topic ③返信 アプリB Kafka固有の実装を吸収 イベント送信先をYAMLで 定義しアプリ間連携 7
source code Build Rev: 1.5 95 % Rev: 2.0 5
% Event Source HTTP requests https://xxx… 8 さいごに.... Knativeの提供する6つの体験 まとめ! 簡単 アプリ実装 簡単 アプリデプロイ 簡単 アクセス設定 簡単 オートスケール 簡単 トラフィック管理 簡単 データ連携 Knative Functions (CLIツール)
❏ Knativeの公式GitHubリポジトリで公開されているサン プルコード https://github.com/knative/docs/tree/main/code-samples ❏ Red Hat が公開しているKnativeのTutorial https://redhat-developer-demos.github.io/knative-tutorial/knative-tuto rial/index.html
❏ KafkaとKnativeを使用したデータパイプラインデモ https://medium.com/analytics-vidhya/automated-data-pipeline-using-c eph-notifications-and-kserving-5e1e9b996661 ❏ 自己学習型のハンズオンコンテンツ (Instruqt) https://github.com/mayumi00/OpenShiftLearning ❏ Istio Bookinfoを活用したハンズオン https://gitlab.com/yono1/openshift-serverless-bookinfo 9 その他の参考情報 Knative等クラウドネイティブ系コンテンツを体 験できますのでぜひご活用ください。
linkedin.com/company/red-hat youtube.com/user/RedHatVideos facebook.com/redhatinc twitter.com/RedHat Red Hat is the world’s leading
provider of enterprise open source software solutions. Award-winning support, training, and consulting services make Red Hat a trusted adviser to the Fortune 500. Thank you
Knative Serving 11 参考. 同期・非同期のマイクロサービスの実装イメージ https://gitlab.com/yono1/openshift-serverless-bookinfo Product page Reviews Rating
Details Order (注文) Stock (在庫) Delivery (配送) Knative Eventing Kafka 注文 Topic 在庫 Topic 配送 Topic ①注文イベント ②注文イベント ③在庫イベント ④在庫イベント ⑤配送イベント ⑥配送イベント
CLIツールを通じて、開発者がアプリを簡単に作成するためのテンプレートや、コンテナのビルド、 Knative Servingによるアプリのデプロイを自動化する CLIツール 複数の言語とフレームワークに対応 kn func create --language python
--template http ① Functionの開発テンプレートの作成 kn func deploy --image ${IMAGE_DIGEST} ②Functionのビルド&デプロイ • Quarkus • Typescript • Nodejs • Go • Rust • Spring Boot • Python kn func invoke ③Functionへの疎通試験 12 おまけ. Knative Functions