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
プロダクトエンジニアとしてのマインドセットの育み方 / How to improve product engineer mindset
saka2jp
1
110
ソースを読む時の思考プロセスの例-MkDocs
sat
PRO
1
370
dbtとAIエージェントを組み合わせて見えたデータ調査の新しい形
10xinc
7
1.8k
GCASアップデート(202508-202510)
techniczna
0
260
Amazon Q Developer CLIをClaude Codeから使うためのベストプラクティスを考えてみた
dar_kuma_san
0
320
ラスベガスの歩き方 2025年版(re:Invent 事前勉強会)
junjikoide
0
890
20251102 WordCamp Kansai 2025
chiilog
1
500
様々なファイルシステム
sat
PRO
0
290
文字列操作の達人になる ~ Kotlinの文字列の便利な世界 ~ - Kotlin fest 2025
tomorrowkey
2
450
AI連携の新常識! 話題のMCPをはじめて学ぶ!
makoakiba
0
180
CloudComposerによる大規模ETL 「制御と実行の分離」の実践
leveragestech
0
160
AWSが好きすぎて、41歳でエンジニアになり、AAIを経由してAWSパートナー企業に入った話
yama3133
2
230
Featured
See All Featured
The Power of CSS Pseudo Elements
geoffreycrofte
80
6k
Music & Morning Musume
bryan
46
6.9k
How STYLIGHT went responsive
nonsquared
100
5.9k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Side Projects
sachag
455
43k
The Art of Programming - Codeland 2020
erikaheidi
56
14k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.5k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3k
Building a Scalable Design System with Sketch
lauravandoore
463
33k
Keith and Marios Guide to Fast Websites
keithpitt
412
23k
The Invisible Side of Design
smashingmag
302
51k
Embracing the Ebb and Flow
colly
88
4.9k
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 “