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.1k
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
ピラミッド、アイスクリームコーン、SMURF: 自動テストの最適バランスを求めて / Pyramid Ice-Cream-Cone and SMURF
twada
PRO
10
1.3k
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
110
Ethereum_.pdf
nekomatu
0
460
レガシーシステムにどう立ち向かうか 複雑さと理想と現実/vs-legacy
suzukihoge
14
2.2k
AWS Lambdaから始まった Serverlessの「熱」とキャリアパス / It started with AWS Lambda Serverless “fever” and career path
seike460
PRO
1
250
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
110
Laravel や Symfony で手っ取り早く OpenAPI のドキュメントを作成する
azuki
1
110
Contemporary Test Cases
maaretp
0
130
ふかぼれ!CSSセレクターモジュール / Fukabore! CSS Selectors Module
petamoriken
0
150
最新TCAキャッチアップ
0si43
0
140
Better Code Design in PHP
afilina
PRO
0
120
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
170
Featured
See All Featured
4 Signs Your Business is Dying
shpigford
180
21k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.3k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.8k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2.1k
Embracing the Ebb and Flow
colly
84
4.5k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Bash Introduction
62gerente
608
210k
Building a Scalable Design System with Sketch
lauravandoore
459
33k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
The Art of Programming - Codeland 2020
erikaheidi
52
13k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
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ج൫ͱͯ͠ͷඪ४ʹͳΓͭͭ͋Δ ·ͱΊ