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
Knativeを使うと何が嬉しいの?
Search
小野佑大
June 24, 2023
Technology
700
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
38
分断された OT と IT を繋ぐ架け橋 -Kubernetes が切り拓く 産業用組み込み製品の現在地 -
yudaiono
1
250
クラウドネイティブがもたらす組み込み開発のパラダイム
yudaiono
0
280
製造DXを加速するIT/OT融合プラットフォーム
yudaiono
0
330
組み込み開発でクラウドネイティブを始める方法
yudaiono
1
250
30分で分かるKnative実践ガイド
yudaiono
1
300
リアルとバーチャルを繋ぐエッジネットワーキング動向
yudaiono
1
410
SAS Viyaの基盤にOpenShiftが最適の理由
yudaiono
0
880
オープンソースから見るエッジコンピューティングの現在と未来
yudaiono
0
320
Other Decks in Technology
See All in Technology
GoのInterface内部構造から学ぶ!最高パフォーマンスを出すコード設計
yappli_developers
0
200
データ_AIの事業の勝敗をわけるもの
nek0128
1
460
Genieを崇めよ
kameitomohiro
0
170
Goodbye ShellScript, Hello File-based App
shunsock
0
400
AIで社員の自主発信に広報目線を組み込む
_mossann_t
0
130
時うどん〜Socket.getifaddrsで学ぶネットワーク編 / Tokiudon: The Socket.getifaddrs Edition
coe401_
3
150
開発投資の期待値を上げるプロダクトロードマップづくり ~プロダクトエンジニアが越境して事業を伸ばす~
kekekenta
1
230
あけおめLINE 傾向とその対策
nasa9084
0
180
The Knowledge Spine: A Machine-Executable Ontology for Governed Marketing Activation
vananth22
0
110
AIによるクリエイティブ生成を行う上での試行錯誤
plaidtech
PRO
0
160
リアーキテクチャ後の障害ゼロを目指したShadow Testingの取り組み
nihonbuson
PRO
1
160
え、こんなに早く改修できるの?──新人エンジニアとスクラムマスターの2人が語る、AI×アジャイル開発の現場
ysasago
2
530
Featured
See All Featured
BBQ
matthewcrist
89
10k
It's Worth the Effort
3n
188
29k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
300
WENDY [Excerpt]
tessaabrams
14
39k
Building an army of robots
kneath
307
46k
Designing Powerful Visuals for Engaging Learning
tmiket
1
570
How Software Deployment tools have changed in the past 20 years
geshan
1
34k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.6k
Statistics for Hackers
jakevdp
799
230k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
700
How to make the Groovebox
asonas
2
2.4k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.2k
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