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 小野佑大
変化に強くなる!ソフトウェア定義型生産ラインの道標
yudaiono
0
1
分断された OT と IT を繋ぐ架け橋 -Kubernetes が切り拓く 産業用組み込み製品の現在地 -
yudaiono
1
180
クラウドネイティブがもたらす組み込み開発のパラダイム
yudaiono
0
270
製造DXを加速するIT/OT融合プラットフォーム
yudaiono
0
310
組み込み開発でクラウドネイティブを始める方法
yudaiono
1
240
30分で分かるKnative実践ガイド
yudaiono
1
280
リアルとバーチャルを繋ぐエッジネットワーキング動向
yudaiono
1
400
SAS Viyaの基盤にOpenShiftが最適の理由
yudaiono
0
850
オープンソースから見るエッジコンピューティングの現在と未来
yudaiono
0
310
Other Decks in Technology
See All in Technology
「待ち時間」の消滅と「自我消耗」の加速:生成AI時代のエンジニアを救うメンタル・リソース管理
poropinai1966
0
320
システム監視を 「システムを監視するだけ」で 終わらせないために
seiud
0
150
カメラ×AIで挑む「ホワイト物流」― 車両管理、自動化の壁と突破口【SORACOM Discovery 2026】
soracom
PRO
0
180
データ活用研修 データマネジメント【MIXI 26新卒技術研修】
mixi_engineers
PRO
4
770
GMOフィナンシャルゲートが挑む、「止まらない」決済インフラ構築の裏側【SORACOM Discovery 2026】
soracom
PRO
0
110
AI時代の強いチームの作り方
yuukiyo
2
670
QA・ソフトウェアテスト研修【MIXI 26新卒技術研修】
mixi_engineers
PRO
3
1.7k
AIエージェントがあれば技術書なんてすぐ書けるでしょ→無理でした
watany
6
1.1k
事業成長とAI活用を止めないデータ基盤アーキテクチャの設計思想
hiracky16
0
770
Claude Mythos、Fable...フロンティアAIの最新動向と企業のセキュリティ対策
flatt_security
0
170
VPCセキュリティ対応の最新事情
nagisa53
1
340
なぜMIXIはゼロトラスト基盤として クラウドフレアを選んだのか - Cloudflare Peer Point SASE User Voices
mixi_engineers
PRO
2
130
Featured
See All Featured
For a Future-Friendly Web
brad_frost
183
10k
BBQ
matthewcrist
89
10k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
190
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.9k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
420
WENDY [Excerpt]
tessaabrams
11
39k
Utilizing Notion as your number one productivity tool
mfonobong
4
480
The Curse of the Amulet
leimatthew05
2
13k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
190
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
610
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
260
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