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
小野佑大
June 24, 2023
Technology
690
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
170
クラウドネイティブがもたらす組み込み開発のパラダイム
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
850
オープンソースから見るエッジコンピューティングの現在と未来
yudaiono
0
310
エッジデバイスでKubernetesが期待される3つの理由
yudaiono
0
450
Other Decks in Technology
See All in Technology
『AIに負けない』より『AIと遊ぶ』」〜ワクワクが最強のテスト・QA学習戦略_公開用
odan611
1
370
背中から、背中へ /paying forward to community
naitosatoshi
0
210
AI時代のエンジニアキャリアについて今一度考える
sakamoto_582
1
1k
Kotlin 開発のツラミを爆破した話! / Explode the difficulty of Kotlin dev!
eller86
0
140
CSに"SLO"は要らない、経営層に"99.9%"は伝わらない - SREを全社に"翻訳"する3原則
cscengineer
PRO
0
110
#エンジニアBooks 30分でわかる 「技術記事を書く技術」 / engineer-books 2026-06-30
jnchito
1
180
SRE歴2ヶ月でも開発6年の知見を活かして、チームで止まっていた環境改善を前に進めた話
a_ono
0
190
知見・人・API・DB・予算 ─ ナイナイ尽くしだった人事データ整備 with dbt、5年間の学び
ken6377
1
140
AWS Summit の片隅で、体育座りしながらコミュニティがにぎわう理由を考えた
k_adachi_01
2
340
Docker Desktop不要の時代が来る? WSL標準の「wslc」で Linuxコンテナを動かしてみた.
ueponx
0
620
product engineering with qa
nealle
0
140
AIDLC_ヤフーショッピングの取り組み
lycorptech_jp
PRO
0
510
Featured
See All Featured
The Mindset for Success: Future Career Progression
greggifford
PRO
0
370
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
270
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
250
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.5k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.3k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Facilitating Awesome Meetings
lara
57
7k
From π to Pie charts
rasagy
0
230
ラッコキーワード サービス紹介資料
rakko
1
3.8M
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
55k
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