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
20180126 M3 TechTalk OpenFaaSお試し
Search
tshohe
January 26, 2018
Technology
94
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
20180126 M3 TechTalk OpenFaaSお試し
tshohe
January 26, 2018
More Decks by tshohe
See All by tshohe
20190712 M3 TechTalk キーキャップ作る話
tshohe
0
1.5k
SRE Lounge #9 エムスリーはどのようにしてSREを始めたか
tshohe
11
19k
Other Decks in Technology
See All in Technology
GitHub Copilot運用のリアル ~AI Credit時代にどう向き合うか~
takafumisu2uk1
0
500
はてなのサービス基盤を支える Kubernetes《足腰》
masayoshimaezawa
0
200
toB プロダクトから見たWAF
tokai235
0
250
秘密度ラベル初心者が第1歩でつまづかないための「設計・運用」ポイント
seafay
PRO
1
520
Kotlin 開発のツラミを爆破した話! / Explode the difficulty of Kotlin dev!
eller86
0
100
CVE-2026-20833_脆弱性対応とAES 化について
jukishiya
0
190
感情と身体を置き去りにしない、エンジニアの生きのこり方 ──いまから、ここから「自分の状態」を扱うという選択
saorimurooka
0
380
千葉での単身赴任からAWSをやり続け、千葉に戻ってきた話
yama3133
1
130
AIは、人間らしい仕事の夢を見るか?─ AI時代のtoB/toEプロダクトを再設計する
techtekt
PRO
0
160
2026 AI Memory Architecture
nagatsu
0
600
Zenoh on Zephyr on LiteX
takasehideki
2
130
AI時代のコスト管理を考えよう〜明日から使える実践AWSノウハウ~
yoshimi0227
0
970
Featured
See All Featured
The SEO identity crisis: Don't let AI make you average
varn
0
500
The Pragmatic Product Professional
lauravandoore
37
7.3k
Mobile First: as difficult as doing things right
swwweet
225
10k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
250
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.3k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
65
56k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.6k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
260
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Discover your Explorer Soul
emna__ayadi
2
1.1k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
620
Transcript
OpenFaaS Λࢼͯ͠Έͨ Shohei Takahashi
Who am I? • ߴڮ উฏʢ͔ͨ͠ ͠ΐ͏͍ʣ • 2017/11݄ೖࣾ •
ΠϯϑϥνʔϜॴଐͷSREͱͯ͠ಇ͍ͯ·͢ɻ • ٕज़ɿJava (Spring Boot), Python (Django), PostgreSQLɺ Elastic StackʢElasticsearch, Logstash, Kibanaʣ • झຯɿRaspberry Pi ༡ͼ
͜Ε·Ͱ • ϞϊϦγοΫͳΞϓϦ͔͠ॻ͍ͯͳ͍… • ӡ༻͢͠͞ͱ͔ಛʹҙࣝͯ͠ͳ͍… • ͳΜ͔ͦΕͬΆ͍͜ͱ͍ͨ͠
ڥ • ίʔυ͚ͩॻ͚͋ͱ͍͍ײ͡Ͱಈ͍ͯ͘ΕΔ • मਖ਼͕༰қɺଈ࠲ʹөՄೳ • ΠϯϑϥΛ͋·Γҙࣝ͠ͳͯ͘ྑ͍ • ӡ༻ଆཧָ͕ •
ͱ͔ʁ
OpenFaaS • ίϯςφܕαʔόϨεϑϨʔϜϫʔΫ • Docker/Swarm/Kubernetes⎈্ͰFaaSڥΛߏஙͰ͖ Δͭ • MITϥΠηϯε • ΫϥυαʔϏεͱҟͳΓॾʑͷ੍ݶͳ͠
• Auto-Sacle Մೳ
ಋೖ • KubernetesΛόοΫΤϯυͱͯ͠͏ͨΊͷϓϥάΠϯfaas-netes͕͋Δ • helmͰೖΔΒ͍͠ʢෆ۩߹͕͋ͬͨͷͰkubectlͰʣ • OpenFaaS on Kubernetes on
Rancher $ curl -LO https://github.com/openfaas/faas- netes/archive/master.zip $ unzip master.zip $ cd faas-netes-master $ kubectl apply -f ./namespaces.yml $ kubectl apply -f ./yaml
http://[kubernetes host]:31112/ui/
ྲྀΕ 1. function هࡌ 2. function Λ Docker image ͱͯ͠Ϗϧυ
3. Docker Registry ʹ push 4. function Λ deploy
function هࡌ • GUIͰ͍͍͚Ͳɺcliπʔϧ͕͋ΔͷͰͦΕΛ͏ʢbrewͰೖΔʣ • ্هίϚϯυͰԼهͷΑ͏ͳܗ͕࡞͞ΕΔ ʢݴޠPythonΛબɺ͍Ζ͍Ζબ·͢ʣ • template ……
֤ݴޠ༻ͷDockerfileʢgo, node.js, ruby, python, C#ʣ • ໊ؔσΟϨΫτϦ • handler.py ……. ࣮ࡍͷؔΛهࡌ͢Δɻ • requirement.txt …… ͍͍ͨύοέʔδ͕͋Ε • ໊ؔ.yml …… gateway, language, docker image nameઃఆ $ faas-cli new --lang python test-function $ ls template test-function test-function.yml
function هࡌ • stdinΛड͚औͬͯstdoutΛ݁Ռͱͯ͠ฦ͢functionΛهࡌ • ͻͱ·ͣ͠ࢉؔΛ࡞ $ vi test-function/handler.py import
json def handle(req): json_req = json.loads(req) answer = int(json_req["a"]) + int(json_req["b"]) result = {"answer": answer} print(json.dumps(result))
function Ϗϧυ • [Local Docker Registry]:5000/tshohe/test-function: 0.0.1 ͱͯ͠Ϗϧυ • ϩʔΧϧͰςετͱ͔Ͱ͖Δ
• ϕʔεͷpython 2.7-alpine͕Ͱ͔͍ͷͰɺ݁ߏͰ͔͍ $ faas-cli build -f ./test-function.yml $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE [Local Docker Registry]:5000/tshohe/test-function 0.0.1 ae45b01bb0bb 34 seconds ago 81.1MB
function deploy & ࣮ߦ • ͠ࢉ͕࣮ߦͰ͖ͯΔ • -> API Gateway
<-> Watchdog <-> Function $ faas-cli push -f ./test-function.yml $ faas-cli deploy -f ./test-function.yml $ curl [kubernetes host]:31112/function/test-function -d '{"a":1,"b": 2}' {"answer": 3}
• tagΛ0.0.2ʹͯ͠build & push & deploy • өʂ function मਖ਼
- answer = int(json_req["a"]) + int(json_req["b"]) + answer = int(json_req["a"]) * int(json_req[“b”]) $ curl [kubernetes host]:31112/function/test-function -d '{"a":1,"b":2}' {"answer": 2} • function Λमਖ਼ • tagΛࢦఆͯ͠͠deploy͢Ε͙ͤ͢Δ
function ࣮ߦ࣌ؒՄࢹԽ • Grafanaʹ༗ࢤ͕࡞ͨ͠μογϡϘʔυ͕͋Δ༷ • ҰॹʹPrometheusೖΔͷͰͦ͜Λσʔλιʔεʹࢦఆ͢Δ͚ͩ • AlertManagerσϑΥϧτͰઃఆ͞Ε͍ͯͨΓ͢Δʢ͔ͨ͠ෛՙ্ঢ࣌ɺίϯςφࣦؕ࣌ʣ
·ͱΊ • ׂΓͱ؆୯ʹࢼָͤͯ͛͠ • Ͳ͏αʔϏεΛߏஙͰ͖Δ͔ະ • ΠϕϯτΛݕ࣮ͯ͠ߦͰ͖Δͷ͔ɺͱ͔ • શମ૾ͷཧେมͦ͏ •
function ຖʹόʔδϣϯཧͱ͔ࠞཚͦ͠͏ • Auto-scaleɺFunction Chain ͱ͔ࢼͯ͠Έ͍ͨ
ͦͷଞ function • StoreͳΔͱ͜Ζʹ୭͔͕࡞͕ͬͨؔஔ͍ͯ͋ͬͨΓ