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
KubernetesでDrupalを構築した話
Search
Yosuke Enomoto
January 16, 2019
570
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
KubernetesでDrupalを構築した話
bmxug.tokyo #6 Docker/Kubernetesの登壇資料
https://bmxug.connpass.com/event/112451/
Yosuke Enomoto
January 16, 2019
More Decks by Yosuke Enomoto
See All by Yosuke Enomoto
Lapras正夢グランプリLT資料.pdf
motuo1201
0
22
Devinと探るBigQueryを使ったデータ分析入門
motuo1201
1
73
Shisho_Cloudを使った自動セキュリティ診断環境を作る.pdf
motuo1201
0
78
ドクターメイトエンジニアカルチャーブック
motuo1201
0
150
もう話すことに困らない! カジュアル面談の “型” 全部見せ
motuo1201
0
570
CROSS Party online 2022 ~自重トレ~
motuo1201
0
460
IoT LT Vol7 LT
motuo1201
0
250
IBM Cloud Fest Online 2020
motuo1201
0
850
IBM Championが考えるアプリケーション基盤の勘所
motuo1201
0
270
Featured
See All Featured
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
450
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
230
Mind Mapping
helmedeiros
1
350
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Ruling the World: When Life Gets Gamed
codingconduct
0
330
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
We Have a Design System, Now What?
morganepeng
55
8.3k
A better future with KSS
kneath
240
18k
ラッコキーワード サービス紹介資料
rakko
1
4.8M
Discover your Explorer Soul
emna__ayadi
2
1.3k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2.1k
Transcript
KubernetesでDrupalを 構築した話
自己紹介 千葉県内で社内SEやってます。 motuoという名前でQiita書いたりしてます。 https://qiita.com/motuo よく使うのはLaravelで、IBM Cloud(PaaS)で 遊んでいます。 2019年度 IBM Champion認定頂きました!
2
始めに Webサイトを構築するにあたって、IBM Developerのサンプルコードを利用しています。 https://developer.ibm.com/jp/patterns/run-drupal-website-on-kubernetes/ 3 Kubernetesだけではなく、PaaSやBlockChain等、様々なコードのサンプルがありますので、 是非、覗いてみて下さい。
今回はKubernetesのお話 4
Kubernetesって何だっけ? 【出典】 https://kubernetes.io/docs/concepts/overview/what-is-kubernetes/#what-does-kubernetes-mean-k8s (ザックリ理解) ▪ コンテナを統合して管理するツール ▪ コンテナ単体だと難しいホストを跨いだ構成 も、上手く制御できる。 ▪
オートスケールやコンテナの自動回復にも 対応している。 ▪ マイクロサービスに適している。
今回、構築したシステム 6 PHP製のCMS
サイト構築の為にやったこと ▪ IBM CloudでKubernetesのクラスタを準備 ▪ Githubで公開されているリポジトリをClone ▪ ローカルから以下のコマンドを実行 7 kubectl
create -f kubernetes/local-volumes.yaml kubectl create -f kubernetes/postgres.yaml kubectl create -f kubernetes/drupal.yaml
これだけ 8
何だか分からないけど、サイトの構築ができてしまった 9
IBMのCode patternって凄い! …じゃなくて 10
Kubernetesの勉強がしたかったのに… 結局、何がどうなってWebサイトが出来たのよ? 1. yamlの壁を実感...(IBM Cloud関係ないけど) 2. 新規クラスタを作成したときに何が起きたの? 3. コンテナイメージってどこに置けば良いの? 11
というわけで・・・ BMXUGに相談だ! 12
この本の著者の方にも参加いただいています 13
1. yamlの壁を壊していこう 14
まずはyamlの壁を壊していこう (local-volumes.yaml) 15 --- apiVersion: v1 kind: PersistentVolume metadata: name:
local-volume-1 labels: type: local spec: capacity: storage: 10Gi accessModes: - ReadWriteOnce hostPath: path: /tmp/data/pv-1 persistentVolumeReclaimPolicy: Recycle --- Step1: Persistent-Volumeを確保 ▪ hostpathはどこでも良い ▪ storageの容量は上限あり
まずはyamlの壁を壊していこう(postgres.yaml) 16 --- apiVersion: v1 kind: Service metadata: name: postgresql
labels: app: drupal spec: ports: - port: 5432 selector: app: drupal tier: postgreSQL --- Step2-1: postgresqlのService登録 ▪ 複数存在するポッドの数やノー ドの存在を意識せずに 抽象的なアクセスを提供する
まずはyamlの壁を壊していこう(postgres.yaml) 17 --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: postgres-claim
labels: app: drupal spec: accessModes: - ReadWriteOnce resources: requests: storage: 10Gi --- Step2-2: postgresqlのVolume要求 ▪ 今回は10GBの容量を要求 ▪ すると、自動的に先述の local-volumeが割当てられる
まずはyamlの壁を壊していこう(postgres.yaml)※抜粋 18 spec: containers: - image: postgres:latest name: postgresql env:
- name: POSTGRES_USER value: drupal ports: - containerPort: 5432 name: postgresql volumeMounts: - name: postgresql mountPath: /var/lib/postgresql/data volumes: - name: postgresql persistentVolumeClaim: claimName: postgres-claim Step2-3: 実際のpostgresqlの設定 ▪ イメージの取得 ▪ 環境変数の定義 ▪ データ保管場所の定義
まずはyamlの壁を壊していこう (drupal.yaml) 19 Drupalのyaml定義はpostgresqlと 同じ構成なので割愛
2. クラスタって どうなっているの? 20
ボタン1つで出来ちゃったけど。。。 21
PaaS使ってきた人の疑問 ▪ メモリとかCPUとかどれ位使えるの? ⇒yamlの設定で、使用量を設定できる。 (但し、上限値あり) ▪ ワーカーノードを増やせば使えるリソースも 増える? ⇒使えるリソースも増えるが、前述の通り上限あり 22
3. イメージはどこに置くの? 23
Docker HubやIBM Cloud Container Registryに置こう 24
IBM Cloud Container Registryの画面イメージ 25 ▪ Docker HubがIBM Cloud内にもある感じ ▪
これを使えば、Docker Hubのプライベートレジストリは いらない。
26 THANKS! ありがとうございました!