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
Turning Architecture into Unit Tests in the AI Era (NSSpain XIV)
steliosf
PRO
1
140
[ハンズオン]AIへの指示だけで「五目並べ」を作ってみよう
satoshi256kbyte
1
360
技術的負債を組織課題として解く-増えすぎたマイクロサービスとの戦い-
reimaru
1
3k
HTML-in-Canvasで作る未来のWeb UI表現
clockmaker
3
3.5k
見えないものを探る要求要件定義に必要な基本的思考 / invisible-requirement-thinking
minodriven
15
8.2k
【加筆修正版】Laravel のアプリケーションをどこにデプロイするか #phpcon_ehime
akase244
0
150
動作中のプログラムの中身をリアルタイムに覗く / Realtime Debugger for CSharp with Roslyn
prota
1
1.8k
Domain-Driven Transformation
hschwentner
2
2.3k
APNsからLive Activityを開始する話
yumnumm
0
160
複雑なUIコンポーネントとの ⻑い付き合い⽅:波及するバグからテスト戦略を経て、安全な再設計へ
mixplace
0
350
mrbgem 三角測量 開発
ogom
0
230
sbt 2.0: takeoff
eed3si9n
0
120
Featured
See All Featured
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
980
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1k
Making Projects Easy
brettharned
120
6.8k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
4
1.2k
The untapped power of vector embeddings
frankvandijk
2
1.9k
Google's AI Overviews - The New Search
badams
0
1.6k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
370
RailsConf 2023
tenderlove
30
1.6k
Building Adaptive Systems
keathley
44
3.2k
Believing is Seeing
oripsolob
1
240
Build your cross-platform service in a week with App Engine
jlugia
234
19k
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Ͱಈ͍͍ͯΔΞϓϦΛ ·ͣҠߦͯ͠Έͯӡ༻ͯ͠ΈΔͷ͕ϕλʔ ·ͱΊ
͓ΘΓ