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
Deploying a Containerized Application On GKE
Search
hayashiki
December 23, 2017
Programming
110
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Deploying a Containerized Application On GKE
hayashiki
December 23, 2017
More Decks by hayashiki
See All by hayashiki
FirestoreのN:N関連の設計の話
hayashiki
0
610
Okayama-2018winter-gae-public.pdf
hayashiki
2
780
Other Decks in Programming
See All in Programming
マイコン向けの軽量Ruby「PicoRuby」で各種デバイスを制御するネイティブアプリの実現手法
bash0c7
0
420
Java 27新機能 / Java 27 new features
kishida
2
150
モジュールの視点からSwiftを読み解く #iosdc
s_shimotori
0
180
{ Android | Kotlin } Gradle Plugin in 2026
ryunen344
1
330
Security issues being discussed on Web Platforms
petamoriken
0
980
[GoCon2026] When Goroutines Are Not Enough: Runtime Locality in High-Throughput Go
takehaya
6
2.3k
WebRTC映像をAirPlayに対応させる挑戦.pdf
monolithic_adam
0
290
選挙速報を多くのユーザーへ 届ける Live Activities 設計
hamayokokuririn
0
150
XHTMLが残したもの
yosuke_furukawa
PRO
2
820
数年滞っていたダークモード対応をおよそ2週間で完了させる
chigichan24
0
730
モデルのリファクタリングが難しいと思ったら、そもそも複雑だったのはビジネス仕様だった ? / is-the-business-domain-the-real-complexity
hatsu38
0
350
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
200
Featured
See All Featured
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
500
Site-Speed That Sticks
csswizardry
13
1.5k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
380
The Language of Interfaces
destraynor
162
27k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
280
Rails Girls Zürich Keynote
gr2m
96
14k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.6k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
203
76k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
390
Scaling GitHub
holman
464
140k
Transcript
Deploying a Containerized Application on Google Kubernetes Engine Masayuki Hayasida
Software Developer at Framgia.Inc 2017/12/23
self-introduction Software Engineer Framgia.Inc ɾ࠷ۙԬࢁҾͬӽ͖ͯͨ͠ ɾϑϧϦϞʔτϫʔΧʔ ɾ͖ͳٕज़ - Frontend(react,
redux, angular) - Infrastructure(GCP, AWS, Azure, VPS…) - GAS, Slack, Serverless… ୲ྖҬ͜ͷΜ
today’s topic ɾWhat’s kubernetes ɾWhat’s GKE ɾHow to provide an
application on GKE ɾOthers
Kubernetes
What’s Kubernetes ? Kubernetes is an open-source system for automating
deployment, scaling, and management of containerized applications. ɾAutomatic binpacking ɾHorizontal scaling ɾAutomated rollouts and rollbacks ɾStorage orchestration ɾSelf-healing ɾService discovery and load balancing ɾSecret and configuration management ɾBatch execution
Α͏͢Δʹɺɺ ίϯςφΫϥελϚωʔδϟͰ͢ ɾίϯςφͷΦʔτεέʔϧ ɾϦιʔεεέδϡʔϧ ɾϩʔυόϥϯγϯά ɾetc…
How can I use Kubernetes ? ɾGCP (Compute Engine, Kubernetes
Engine) ɾAWS (AmazonEC2, AmazonEKS new! ) ɾAzure(Azure Container Service) ɾIBM Blue Mix ɾetc… ϚωʔδυͰͳͯ͘ɺselfhost͢Δ͜ͱՄೳɻ ͯͬͱΓ͘͡ΊΔʹύϒϦοΫΫϥυΛͬͨํָ͕ʹߏஙͰ͖Δ
Kubernetes Architecture
Kubernetes Architecture
Pod / Deployment
Pod / Deployment PodɿίϯςφΛάϧʔϐϯάԽͨ֓͠೦ Deployment: PodΛ্ཱͪ͛ͷఆ͚ٛͮΛͨ͠ͷ - template: Podఆٛ -
replicas: Podͷಉ࣌ىಈΛఆٛ and keep PodͷϨϓϦΧ্ݶNodeͷεϖοΫʹґଘ͢Δ - image: docker image file ӈͷྫͰɺnginxͷPodΛport:80Ͱ3ͭͨͪ͋͛ͯʔ
kubernetesͷૢ࡞ɺkubectl
Service
Service - ओʹ෦తͳωοτϫʔΫཧΛߦ͏ - τϥϑΟοΫͷडΛ୲͏ΞΫηείϯτϩʔϥ ಉҰͷPodʹදIPΛ͚ͭͯ;ΓΘ͚Δ ͖͞΄ͲͷnginxPodͷϨϓϦΧ3ͭ ͍͍ײ͡ʹ;ΓΘ͚ͯʔ
Ingress
Ingress - άϩʔόϧͷϩʔυόϥϯαΛఆٛ - HOSTTLSઃఆΛ͢Δ - ΞΫηεϧʔϧͷઃఆ͕Մೳ όʔνϟϧϗετURLʹΑΔ αʔϏεͷ;ΓΘ͚ ར༻ྫɿ
- ෳ։ൃػͰαϒυϝΠϯຖʹ ΞΫηεϧʔϧΛ࡞ - ຊ൪ػ / ։ൃػΞΫηεΛৼΓ͚
Kubernetes
Kubernetes on GKE
Kubernetes on GKE
GKE is … ɾΫϥελͷૢ࡞GCP-SDKͷgcloudͰૢ࡞
None
࣮ྫɿࣗࣾαʔϏε
GCP Architecture
Main Application
Main Application
Nginx /healthz Ͱ Ϩεϙϯε200Λ͔͑ͯ͋͛͠Δ
Rolling Update ஈ֊తʹPodΛ͍Ε͔͑ͯ͘ΕΔɻ μϯλΠϜθϩํࣜ
Puma / Sidekiq
Secrets / ConfigMap ɾconfϑΝΠϧ dockerʹ;͘Ίͣɺ volumeΛϚϯτͯ͠͏
- db:migrateassets-precompileͷrakeλεΫશൠJobͰߦ͏ - db-migrationΛ͢ΔPodΛͨͪ͋͛ - rakeλεΫΛ࣮ࢪɺͦͯ͠Λͨͯ͠ࢮΜͰ͍͘ Job
Job Script
ఆظతʹ࣮ߦ͢ΔJobɺϐϯϙΠϯτͷ࣌ؒଳʹ࣮ߦ͍ͨ͠߹CronJobΛ͏ ਂͷrakeλεΫʢఆظతͳΫϦʔχϯάॲཧʣΛCronJobͰ࣮ߦ͍ͯ͠Δ CronJob
- VolumeϑΝΠϧΛComputeEngineͷDisk͔ΒऔಘͰ͖Δ - Pod͔ΒಡΈࠐΉͱ͖readonly ͳͷͰɺผdiskΛऔಘ͠ɺPodΛ࠶࡞͢Δͱ͔͍͏ΊΜͲ ͍͘͜͞ͱΛ͠ͳ͚ΕͳΒͳ͍ R/W͠ͳ͕ΒӬଓԽ͍ͨ͠ʹ͋Γ GCEPersitentDisk / assets:precompile
ͨͩ͠ʂʂʂʂ υΩϡϝϯτൈਮ
Ͳ͏͢Δʁʁ
https://github.com/kubernetes/examples/blob/master/staging/volumes/nfs/README.md NFS NFSαʔόΛؒʹ͞ΉͱෳϙουͰR/WͰϘϦϡʔϜར༻͕Մೳ
Build / Deploy
Build / Deploy
Private Registory
Container Registry / Cloud Container Builder - KMSʹΑΔɺconfig/database.ymlͷෳ߹ -
KMSʹΑΔɺconfig/secrets.ymlͷෳ߹ - migration - docker build and push GCR - kubectl set image - slack notifications
Container Registry / Cloud Container Builder
Container Registry / Cloud Container Builder
Logging / Monitoring
Logging / Monitoring
- ඪ४ग़ྗͨ͠ͷશͯɺStackdriverग़ྗ͞ΕΔ - Stackdriver͔ΒStackdriverMonitoringͷ࿈ܞ - ϩάͷܗࣜJSON͕Α͍ - StackdriverͷϩάσʔλҎԼͷGCPαʔϏε࿈ܞՄೳ - Cloud
Pub/Sub - Cloud Storage - BigQuery Logging(Stackdriver)
Stackdriver -> PubSub-> ElasticStack - PubSubͰlogstashͷpiplineʹϩάΛྲྀ͜͠Έɺ Elasticserchʹͱͯ͠ɺkibanaͰՄࢹԽʂ - ओʹোௐࠪ༻్
Stackdriver -> BigQuery -> DataStudio
Monitoring (Prometheus * Grafana) - Pod୯ҐͰੑೳࢹ͕Ͱ͖Δɻଟ࠼ͳMetrics - OpenMetricsͱͯ͠ͷσϑΝΫτʹͳΓͦ͏ - ԼͷΩϟϓνϟͷΑ͏ʹɺͳʹΑΓGrafanaΧοίΠΠΑͯ͘
ςϯγϣϯ͕͕͋ΔɻͪΖΜAlertઃఆͰSlack௨Մೳ
ͬͯͳ͍͕ɺҰԠػೳΛONʹ͍ͯ͠Δ Monitoring (Stackdriver)
ɾSpinnecker, Istio, gRPCͳͲར༻͠ ϚΠΫϩαʔϏεԽΛ͢͢ΊΔ ࠓޙΓ͍ͨ͜ͱ
ɾ·ͱΊKubernetesΛͯͬͱΓ͘ ͡ΊΔͷʹGKE࠷ద ɾҰఆٛϑΝΠϧΛ࡞Ε ผϓϩδΣΫτͰԣஅతʹ͑Δ ɾେྔͷτϥϑΟοΫ͕͋ΔطଘαʔϏεͰ ͷҠߦ৻ॏʹ ɾGAEHerokuͰಈ͍͍ͯΔΞϓϦΛ ·ͣҠߦͯ͠Έͯӡ༻ͯ͠ΈΔͷ͕ϕλʔ ·ͱΊ
͓ΘΓ