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
LoK101.pdf
Search
Jerry
December 11, 2018
Technology
0
270
LoK101.pdf
Jerry
December 11, 2018
Tweet
Share
More Decks by Jerry
See All by Jerry
Gitlab CI 入門
cheng
0
320
Other Decks in Technology
See All in Technology
実装で解き明かす並行処理の歴史
zozotech
PRO
1
660
これがLambdaレス時代のChatOpsだ!実例で学ぶAmazon Q Developerカスタムアクション活用法
iwamot
PRO
5
790
能登半島災害現場エンジニアクロストーク 【JAWS FESTA 2025 in 金沢】
ditccsugii
0
230
JAZUG 15周年記念 × JAT「AI Agent開発者必見:"今"のOracle技術で拡張するAzure × OCIの共存アーキテクチャ」
shisyu_gaku
1
140
Vibe Coding Year in Review. From Karpathy to Real-World Agents by Niels Rolland, CEO Paatch
vcoisne
0
120
カンファレンスに託児サポートがあるということ / Having Childcare Support at Conferences
nobu09
1
500
The Cake Is a Lie... And So Is Your Login’s Accessibility
leichteckig
0
110
LLM時代にデータエンジニアの役割はどう変わるか?
ikkimiyazaki
6
1.2k
Modern_Data_Stack最新動向クイズ_買収_AI_激動の2025年_.pdf
sagara
0
240
社内報はAIにやらせよう / Let AI handle the company newsletter
saka2jp
8
1.3k
10年の共創が示す、これからの開発者と企業の関係 ~ Crossroad
soracom
PRO
1
690
Escaping_the_Kraken_-_October_2025.pdf
mdalmijn
0
160
Featured
See All Featured
Why Our Code Smells
bkeepers
PRO
339
57k
Testing 201, or: Great Expectations
jmmastey
45
7.7k
Large-scale JavaScript Application Architecture
addyosmani
514
110k
Code Review Best Practice
trishagee
72
19k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
32
2.3k
Facilitating Awesome Meetings
lara
56
6.6k
Making Projects Easy
brettharned
119
6.4k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
4 Signs Your Business is Dying
shpigford
185
22k
jQuery: Nuts, Bolts and Bling
dougneiner
64
7.9k
The World Runs on Bad Software
bkeepers
PRO
71
11k
Producing Creativity
orderedlist
PRO
347
40k
Transcript
Laravel on Kubernetes 101
Agenda • 簡單認識 Kubernetes / Docker • 介紹 Kubernetes 各項元件
• 實際部署⼀一個 Laravel Project 到 GKE 上
關於我 • Jerry Cheng • Sr. Software Engineer • 偶爾會假裝⾃自⼰己是
Operator • https://www.facebook.com/ ilay.tw
What is Kubernetes • 容器的全⾃自動管理理/調度平台,誕⽣生⾃自 Google Borg • 不限制 application
類型,只要能容器化的都吃 • 各種抽象化的資源類型 • web/database • task runner • auto scaler • Ingress..
Why Containers • ⼀一致性的執⾏行行環境 • ⽅方便便的應⽤用部署,有利利於持續整合/持續部署 • 清楚的分離 Dev 與
Ops,有利利於分⼯工 • 以應⽤用為中⼼心的管理理⽅方式
Docker • 了了解 Docker Container 的⽣生命週期 • 了了解 Docker Image
的管理理流程
https://docs.microsoft.com/zh-tw/dotnet/standard/microservices-architecture/docker-application-development- process/media/image1.png
Docker Registry • 維護⽅方式跟 Github 有 87% 像,但是放 Docker image
• Dockerhub -> 由 Docker 官⽅方維護,是⽬目前最⼤大的 public registry • Private registry: • VMware Harbor • Gitlab Registry • Cloud: AWS/GCP/Azure…
Kubernetes 資源介紹
Kubernetes Nodes • Node • Node • 負責 Resource 的執⾏行行
• 監控 Resource 的健康狀狀態 • Master Node • 管理理與監控 Node • 負責調度所有的 Resource • 儲存整個 Cluster 的運作狀狀態 • 架設⽅方式 • ⾃自架:minikube / kubeadm / Rancher 2.x (⼈人⽣生短短幾個秋...) • 直接⽤用 Cloud: AWS/ GCP/ Azure/ DigitalOcean…
None
• ⼀一組資源的集合 • 隔離不同 namespace 之間的資源(persistent volume 除外) • 預設有
kube-system/ kube-public/ default https://www.mundodocker.com.br/wp-content/uploads/2017/06/namespaces.png
Pod • Kubernetes 中的最⼩小執⾏行行單位 • ⼀一個完整的 application 部署封裝,可能有⼀一個以上的 container •
共享儲存空間/網路路 https://i0.wp.com/foxutech.com/wp-content/uploads/2018/02/Kubernetes-Pod.jpg
ReplicaSet • 保證 Pod 的數量量跟設定中要求的⼀一樣 • 少了了就補⿑齊,多了了就砍掉,絕對不多不少 • ⽀支援動態縮放 https://prod-edxapp.edx-cdn.org/assets/courseware/v1/27bbf25e6c924d3db9c2e7e568a90bbf/asset-v1:LinuxFoundationX+LFS158x+2T2017+type@asset+block/replicaset-3.png
Deployment • 管理理 Pod 與 ReplicaSet • 聲明式更更新 • ⽀支援
Rolling Update
Rolling Update
Rolling Update
Rolling Update
Rolling Update
Job • 啟動 Pod 並且執⾏行行指定次數 • Pod 如果執⾏行行錯誤,會重新開啟直到完成
Service • ⽤用來來存取 Pod 的資源 • 可透過 Kubernetes 內部的 DNS
來來對應 • 各種 Service Type: • ClusterIP • NodePort • LoadBalancer
ClusterIP Service https://cdn-images-1.medium.com/max/1600/1*I4j4xaaxsuchdvO66V3lAg.png
NodePort Service https://cdn-images-1.medium.com/max/1600/1*CdyUtG-8CfGu2oFC5s0KwA.png
LoadBalancer Service https://cdn-images-1.medium.com/max/1600/1*P-10bQg_1VheU9DRlvHBTQ.png
Ingress • 類似 Virtual Host 的概念念 • 可以⽤用 URL 來來
proxy 到不同的 service https://cdn-images-1.medium.com/max/2000/1*KIVa4hUVZxg-8Ncabo8pdg.png
Label • Key-Value • 可以放在任何的資源設定中作為識別 • 可透過 Selector 查詢
Selector • ⽤用來來查詢 Labels • 透過 Selector 可以查詢到關聯聯的 Labels
https://www.metaltoad.com/sites/default/files/2018-01/Screen%20Shot%202018-01-19%20at%204.23.36%20PM.png
Volume • 在 Pod 啟動時⾃自動掛載(需要先定義) • 可以掛載 Host 的檔案或是⽬目錄 •
也能掛 ConfigMap/ Secret
ConfigMap • ⽤用來來放各種設定 • 可以 mount 到 container 中使⽤用 •
Environment 設定可以放這
Secret • 基本上功能跟 ConfigMap ⼀一樣 • 不過有做 Base64 Encode •
適合放敏感性的資料
Let’s laravel it https://gitlab.com/kube-laravel/
Laravel requirements • Nginx/PHP-FPM • Database (MySQL) • Cache/Session store
(Redis) • Storage (S3/GCS) • Log (ELK) • Exception handler (Sentry)
Q & A “