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
Deploying a Containerized Application On GKE
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
770
Other Decks in Programming
See All in Programming
OSもどきOS
arkw
0
590
AI駆動開発を妨げる技術的負債の解消アプローチ / ai-refactoring-approach
minodriven
15
7.2k
1B+ /day規模のログを管理する技術
broadleaf
0
120
A2UI という光を覗いてみる
satohjohn
1
160
代数的データ型って何が嬉しいの? #frontend_phpcon_do
kajitack
8
3.8k
Hunting Vulnerabilities in Symfony with LLMs
vinceamstoutz
0
560
Oxcを導入して開発体験が向上した話
yug1224
4
340
軽量Java基盤の設計 DIコンテナに頼らない、長期保守と1秒起動の実現 JJUG CCC 2026 Spring
macha64
0
590
技術記事、 専門家としてのプログラマ、 言語化
mizchi
13
6.6k
並列実装の現場、2ヶ月間実務でAIを使い倒したAIもPCも私も限界が近い
ming_ayami
0
130
肥大化するレガシーコードに立ち向かうためのインターフェース分離と依存の逆転 / JJUG CCC 2026 Spring
hirokunimaeta
0
630
ランチタイムLT会3周年!ランチタイムLT会を3年間続けられたお話
y0hgi
1
110
Featured
See All Featured
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.1k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.6k
Building Applications with DynamoDB
mza
96
7.1k
How to Talk to Developers About Accessibility
jct
2
260
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.6k
How to build a perfect <img>
jonoalderson
1
5.7k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
340
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
10k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
370
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
210
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.4k
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Ͱಈ͍͍ͯΔΞϓϦΛ ·ͣҠߦͯ͠Έͯӡ༻ͯ͠ΈΔͷ͕ϕλʔ ·ͱΊ
͓ΘΓ