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
Skaffoldを使ってKubernetes してみた/skaffold_k8s
Search
KOYAMA Tetsuji
June 16, 2018
Programming
2
1.2k
Skaffoldを使ってKubernetes してみた/skaffold_k8s
PHPカンファレンス福岡2018での発表に用いた資料です。
KOYAMA Tetsuji
June 16, 2018
Tweet
Share
More Decks by KOYAMA Tetsuji
See All by KOYAMA Tetsuji
全日本PHPカンファレンス2024スタンプラリーについて/stamprally-php2024
koyhoge
0
120
日本PHPカンファレンス2024スタンプラリーとその実装/phpcon-stamprally
koyhoge
1
1k
日本のPHPカンファレンスの歩みと、その辺もろもろ/phpcon_japan_history
koyhoge
0
240
Inside SWOOLE: 非同期処理はどのようにして動くのか/inside_swoole
koyhoge
0
18k
映画を年300本観る技術/watch_300_movies_in_a_year
koyhoge
0
1.2k
Swooleで実装するPHP非同期処理の世界/phpcondo2019-swoole
koyhoge
3
5.1k
CloudFormation と FaaS のはざま - Kubernetes の設計思想を探る -/cf-faas-k8s
koyhoge
0
1.4k
ITイベントマニアから見る技術イベントの動向/techevent
koyhoge
0
300
東京が大雪の日に何気ない写真がバズった/snow_tree_buzz
koyhoge
0
520
Other Decks in Programming
See All in Programming
Make Impossible States Impossibleを 意識してReactのPropsを設計しよう
ikumatadokoro
0
230
Remix on Hono on Cloudflare Workers
yusukebe
1
300
どうして僕の作ったクラスが手続き型と言われなきゃいけないんですか
akikogoto
1
120
Click-free releases & the making of a CLI app
oheyadam
2
120
OnlineTestConf: Test Automation Friend or Foe
maaretp
0
110
TypeScript Graph でコードレビューの心理的障壁を乗り越える
ysk8hori
2
1.1k
CSC509 Lecture 09
javiergs
PRO
0
140
macOS でできる リアルタイム動画像処理
biacco42
9
2.4k
Figma Dev Modeで変わる!Flutterの開発体験
watanave
0
140
LLM生成文章の精度評価自動化とプロンプトチューニングの効率化について
layerx
PRO
2
190
レガシーシステムにどう立ち向かうか 複雑さと理想と現実/vs-legacy
suzukihoge
14
2.2k
Arm移行タイムアタック
qnighy
0
330
Featured
See All Featured
Teambox: Starting and Learning
jrom
133
8.8k
Keith and Marios Guide to Fast Websites
keithpitt
409
22k
The Language of Interfaces
destraynor
154
24k
[RailsConf 2023] Rails as a piece of cake
palkan
52
4.9k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
0
100
How to train your dragon (web standard)
notwaldorf
88
5.7k
The Cult of Friendly URLs
andyhume
78
6k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Optimising Largest Contentful Paint
csswizardry
33
2.9k
Designing the Hi-DPI Web
ddemaree
280
34k
Transcript
PHPΧϯϑΝϨϯεԬ2018 2018-06-16 4LB⒎PMEΛͬͯ ,VCFSOFUFTͯ͠Έͨ খࢁࢤ !LPZIPHF
ࣗݾհ খࢁࢤ ͜·ͯͭ͡ ߹ಉձࣾ΄ٕ͛ݚ Ϣʔβձ͍͔ͭ͘ ຊ6/*9Ϣʔβձ ຊ1PTUHSF42-Ϣʔβձ ຊ1)1Ϣʔβձ SBLVNPגࣜձࣾΤϯδχΞ
!LPZIPHF LPZIPHF
w (4VJUF (NBJM (PPHMFΧϨϯμʔͳͲ ʹػೳՃ͠ ͯൢച w ಋೖ ࣾҎ্ w
IUUQTSBLVNPDPN w ࡢ(PPHMF$MPVE1MBUGPSN ($1 ͷύʔτφʔʹ
ࠓճͷ༰ w ,VCFSOFUFTͷྺ࢙ w ,VCFSOFUFTͷಛ w 4LB⒎PMEͷಛ w 4LB⒎PMEͷ͍ํ
,VCFSOFUFT w IUUQTLVCFSOFUFTJP w LTͱུ͞ΕΔ w ಡΈʮ͘ʔͶͯ͌͢ʯ w %PDLFS͚ΦʔέετϨʔγϣϯπʔϧ
ࠓճͷ༰ w ,VCFSOFUFTͷྺ࢙ w ,VCFSOFUFTͷಛ w 4LB⒎PMEͷಛ w 4LB⒎PMEͷ͍ํ
LTIJTUPSZ w (PPHMFͷࣾπʔϧͱͯ͠։ൃ։࢝ w (PPHMFͷ#PSH͔Βڧ͍ӨڹΛड͚ͨ1SPKFDU4FWFO w 4FWFO4UBS5SFL7PZBHFSͷ4FWFOPG/JOF͔Β w ϩΰͷຊεϙʔΫͷͷ༝དྷ w
ʹWϦϦʔε w ͦͷޙ$/$'ʹҠ #Z4PVSDF 81/'$$ 'BJSVTF IUUQTFOXJLJQFEJBPSHXJOEFYQIQ DVSJE
LT%PDLFS w %PDLFS$PO&6 w LTͷ%PDLFSͱ౷߹Λൃද w ࣄ্࣮ͷඪ४ΦʔέετϨʔγϣϯπʔϧʹ w ͦͷޙΫϥυք۾͕૽͕͘͠ͳΔ
w (PPHMF$POUBJOFS&OHJOF w ($1ͷ%PDLFSίϯςφӡ༻ϚωʔδυαʔϏε w ུশ(,& ($&$PNQVUF&OHJOFʹΘΕ͍ͯ ͨ w
(PPHMF,VCFSOFUFT&OHJOF (,& ʹվ໊ LTPO($1
w "[VSF$POUBJOFS4FSWJDF "$4 w ࠷ॳ"QBDIF.FTPTϕʔε w ෳͷΦʔέετϨʔγϣϯπʔϧΛαϙʔτ w "[VSF$POUBJOFS4FSWJDF
",4 w ,VCFSOFUFTϕʔε w "[VSF,VCFSOFUFT4FSWJDF ",4 ʹվ໊ LTPO"[VSF
w &MBTUJD$POUBJOFS4FSWJDFGPS,VSCFSOFUFT &,4 w &$4ͱ͍͏ಠࣗϚωʔδυαʔϏεΛ͢Ͱʹ͍ͬͯ ͨ w LTඪ४ͷྲྀΕΛड͚ͯαʔϏεՃ
LTPO"84
ࠓճͷ༰ w ,VCFSOFUFTͷྺ࢙ w ,VCFSOFUFTͷಛ w 4LB⒎PMEͷಛ w 4LB⒎PMEͷ͍ํ
w ʮγεςϜΛߏ͢ΔϓϥοτϑΥʔϜϛυϧΣΞɺ αʔϏεɺΞϓϦέʔγϣϯɺཧπʔϧͳͲͷઃఆ ཧΛࣗతʹ࿈ܞͤ͞Δ͜ͱɻʯ ;%/FU+BQBOΩʔϫʔυղઆΑΓ w ΦʔέετϨʔγϣϯͱͳʹ͔
w ༷ʑͳׂͷίϯςφΛΈ߹ΘͤͯαʔϏεΛ࡞Δͱ ͖ͷɺӡ༻ͷෳࡶੑΛղܾ͢Δ w (PPHMF͕#PSHΛӡ༻͖ͯͨ͠ͱ͖ͷݟ͕٧·ͬͯ ͍Δ LTԿΛղܾ͢Δͷ͔
w Πϛϡʔλϒϧ w એݴతઃఆ w ΦϯϥΠϯͰࣗݾճ෮͢Δ LTͷઃܭίϯηϓτ
w *NNVUBCJMJUZ w Ұ࡞ͨ͠Βมߋ͞Εͳ͍ w ඞཁʹԠͯ͡ಉ͡༰ͷίϯςφΛ͍ͭ͘ىಈͰ͖Δ Πϛϡʔλϒϧ
w ʮԿΛ͢Δ͔ʯͰͳ͘ʮͲ͏͋Δ͖͔ʯΛهड़͢Δ w ࠷ऴతͳ·͍͠ঢ়ଶΛॻ͘ એݴతઃఆ
w ·͍͠ঢ়ଶ͍ͬͯΔ w ܧଓతʹࢹ͠ɺ·͍͠ঢ়ଶʹͳ͍ͬͯͳ͔ͬͨΒͦΕ ʹҰக͢ΔΑ͏ʹಈ͖ଓ͚Δ ࣗݾճ෮͢Δ
apiVersion: v1 kind: Pod metadata: name: nginx spec: containers: -
name: nginx image: nginx:1.7.9 ports: - containerPort: 80 nginx-pod.yml
w Ϋϥελ w 1PE w 4FSWJDF w 3FQMJDB4FU w %BFNPO4FU
w +PC w %FQMPZNFOU w $POpH.BQ LTߏཁૉ
w Ϋϥελ w 1PE w 4FSWJDF w 3FQMJDB4FU w %BFNPO4FU
w +PC w %FQMPZNFOU w $POpH.BQ LTߏཁૉ
w LTڥΛߏ͢ΔϚγϯ܈ w %PDLFS͕ಈ͚ཧཧͲͪΒͰྑ͍ w ΫϥυαʔϏεͰཧը໘ͰϙνΔ͚ͩ Ϋϥελ
w ϫʔΫϩʔυ ίϯςφ ͕ಈ࡞͢Δཧϊʔυ w ෳͷϫʔΫϩʔυ͕ಈ࡞͢Δ߹͋Δ w ಉҰ1PEͷ߹ɺϑΝΠϧγεςϜͰίϯςφಉ࢜ ͕ΓऔΓ͢Δ͜ͱՄೳ 1PE
w ໊લղܾ w ෦Ͱ%/4͕ಈ͍͍ͯΔ w ֎෦ͷΤϯυϙΠϯτ࡞ 4FSWJDF
w αʔϏεҰࣜΛஔ͢ΔΈ w ࢮ׆ࢹ w ߏมߋɾΦʔτεέʔϧ w %PDLFSΠϝʔδͷߋ৽ w Ξοϓσʔτઓུ
%FQMPZNFOU
w LTཧίϚϯυ w جຊ͜ͷίϚϯυ͔Βͯ͢Λߦ͏ LVCFDUM
w IPHFZNMʹαʔϏεͷͯ͢Λॻ͘ํࣜ w ͍ͨΜγϯϓϧ w :".-Ͱ͔͗͢ σϓϩΠ $ kubectl apply
-f hoge.yml
ࠓճͷ༰ w ,VCFSOFUFTͷྺ࢙ w ,VCFSOFUFTͷಛ w 4LB⒎PMEͷಛ w 4LB⒎PMEͷ͍ํ
w IUUQTHJUIVCDPN(PPHMF$POUBJOFS5PPMT TLB⒎PME w ϫʔΫϑϩʔͷࣗಈԽπʔϧ w ·ͩΞϧϑΝ൛Ͱ࣮ݧతͳҐஔ͚ͮ w ࠷৽൛ʹϦϦʔε͞Εͨ 4LB⒎PME
w .BUU3JDLBSE͞Μ w IUUQTHJUIVCDPNSE w ($1ΤϯδχΞ w NJOJLVCFʹؔΘ͍ͬͯΔ ࡞ͬͨͷ͜ͷਓ
w ίϯςφϕʔε։ൃͷ$* w %PDLFSΠϝʔδͷ࡞ɺϨδετϦͷొɺσϓϩΠ ͷͦΕͧΕΛࣗಈԽ ԿΛղܾ͢Δͷ
None
w ։ൃ࣌ w ϏϧυϩʔΧϧͷEPDLFSCVJME w ొͳ͠ w σϓϩΠNJOJLVCFʹLVCFDUM w ຊ൪࣌
($1ͷ߹ w Ϗϧυ(PPHMF$POUBJOFS#VJMEFSʹ͛Δ w ొ(PPHMF$POUBJOFS3FHJTUSZʹొ͢Δ w σϓϩΠ(,&ʹLVCFDUM ྆ऀͷҧ͍
w ΠϝʔδSFQPͷλάΛࣗಈͰଧͬͯ͘ΕΔɻ w ։ൃ࣌ϑΝΠϧΛࢹͯ͠ɺมߋ͕͋ͬͨΒࣗಈͰσϓ ϩΠ·Ͱͬͯ͘ΕΔ ·ͩ͋Δศརػೳ
w #B[FM w IUUQTCB[FMCVJME w )FMN w IUUQTIFMNTI w LBOJLP
w IUUQTHJUIVCDPN(PPHMF$POUBJOFS5PPMTLBOJLP w LVTUPNJ[F w IUUQTHJUIVCDPNLVCFSOFUFTTJHTLVTUPNJ[F w ෳΠϝʔδͷରԠ NJDSPTFSWJDF ֤छπʔϧରԠ
ࠓճͷ༰ w ,VCFSOFUFTͷྺ࢙ w ,VCFSOFUFTͷಛ w 4LB⒎PMEͷಛ w 4LB⒎PMEͷ͍ํ
w TLB⒎PMEίϚϯυͷΠϯετʔϧ w ඞཁͳΒ LVCFDUM NJOJLVCFͷΠϯετʔϧ w ຊ൪σϓϩΠڥͷ༻ҙ ྫ(,& ͰͬͯΈΑ͏
w TLB⒎PMEHP w ֤ϓϥοτϑΥʔϜ༻όΠφϦΛ͍ͬͯΔͷͰࣗͰ Ϗϧυ͢Δඞཁͳ͍ w .BDͳΒ TLB⒎PMEίϚϯυ curl -Lo
skaffold https://storage.googleapis.com/skaffold/ releases/latest/skaffold-darwin-amd64 && chmod +x skaffold && sudo mv skaffold /usr/local/bin
w NBJOHPΛίϯύΠϧ࣮ߦ͢Δ͚ͩͷαϯϓϧ FYBNQMFTHFUUJOHTUBSUFE
NBJOHP package main import ( "fmt" "time" ) func main()
{ for { fmt.Println("Hello world!") time.Sleep(time.Second * 1) } }
%PDLFSpMF FROM golang:1.10.1-alpine3.7 as builder COPY main.go . RUN go
build -o /app main.go FROM alpine:3.7 CMD ["./app"] COPY --from=builder /app .
TLB⒎PMEZNM apiVersion: skaffold/v1alpha2 kind: Config build: artifacts: - imageName: gcr.io/myproj-koyhoge/skaffold-gcb
deploy: kubectl: manifests: - k8s-* profiles: - name: gcb build: googleCloudBuild: projectId: myproj-koyhoge
LTQPEZNM apiVersion: v1 kind: Pod metadata: name: getting-started spec: containers:
- name: getting-started image: gcr.io/myproj-koyhoge/skaffold-gcb
TLB⒎PMEEFW Ϗϧυ ొ σϓϩΠ
w ϑΝΠϧอଘͱಉ࣌ʹҰ࿈ͷ࡞ۀ͕࠶ͼߦΘΕΔ ͦͷ··ϑΝΠϧมߋ fmt.Println("Hello world!") Λ fmt.Println("Hello phpconfuk!")
w Ҏ্ɺऴྃ ຊ൪σϓϩΠ $ skaffold run
w ඪ४తͳ$*$%ͱόοςΟϯά͠ͳ͍ w ͱ͋Εͯ͢ΛίϯςφͰ·͔ͳ͏ࢼΈ໘ന͍ w ͜͜ͰഓΘΕ͍ͯΔݟɺผͷ$*$%ͷΈͰ׆ ͔ͤΔͩΖ͏ ࢼͯ͠ͷײ
w LTࠓͱͯΞπ͍ w TLB⒎PMEΛ͡Ίɺ͞·͟·ͳपลπʔϧ͕։ൃ͞Εɺ ৽͍͠ࢼΈ͕ߦΘΕ͍ͯΔ w αʔϏεͷ044ج൫ͱͯ͠ͷඪ४ʹͳΓͭͭ͋Δ ·ͱΊ