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
『Docker/Kubernetes 実践コンテナ開発入門』輪読会 #5
Search
nagaakihoshi
February 25, 2019
500
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
『Docker/Kubernetes 実践コンテナ開発入門』輪読会 #5
https://yourmystar.connpass.com/event/120903/
nagaakihoshi
February 25, 2019
More Decks by nagaakihoshi
See All by nagaakihoshi
短距離走チームから長距離走チームへの移行プロセス.pdf
nagaakihoshi
0
470
Backlog API x Zapier x Slack で お気づきだろうか!!!!
nagaakihoshi
0
1.3k
WEBサービス開発における仮説思考のための道具
nagaakihoshi
2
660
心理的安全性の 「持ちつ持たれつ」
nagaakihoshi
2
4.4k
レビューで 初心者インターンを 一人前に育てた話
nagaakihoshi
1
1.4k
Featured
See All Featured
Build your cross-platform service in a week with App Engine
jlugia
234
19k
Building Adaptive Systems
keathley
44
3.2k
The Curse of the Amulet
leimatthew05
2
14k
Faster Mobile Websites
deanohume
310
32k
Un-Boring Meetings
codingconduct
0
410
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
270
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
380
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Designing for Timeless Needs
cassininazir
1
470
Transcript
『Docker/Kubernetes 実践コン テナ開発入門』輪読会 #5 2019/02/25 1 @inase17000
Kubernetes入門 5.1 Kubernetesとは 5.2 ローカル環境でKubernetesを実行する 5.3 Kubernetesの概念 5.4 KubernetesクラスタとNode 5.5
Namespace 5.6 Pod 5.7 ReplicaSet 5.8 Deployment 5.9 Service 5.10 Ingress 2
5.1 Kubernetesとは 3 ホストOS Docker コンテナ1 コンテナ2 コンテナ3 ホストOS Kubernetes
Docker Kubernetes Master Node Node1 コンテナ1 コンテナ1 コンテナ1 コンテナ2 Deployment / ReplicaSet Node2 コンテナ1 コンテナ1 コンテナ1 コンテナ2 Deployment / ReplicaSet kube apiserver etcd kube scheduler kube controller manager Service Ingress
5.2 ローカル環境でKubernetesを実行する 4
5.2 ローカル環境でKubernetesを実行する 5 # 5.2.1 curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.10.4/bin/darwin/amd64/kubectl \ &&
chmod +x kubectl \ && mv kubectl /usr/local/bin/ kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.8.3/src/deploy/recommended/kubernetes-dashbo ard.yaml kubectl get pod --namespace=kube-system -l k8s-app=kubernetes-dashboard kubectl proxy http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/
5.2 ローカル環境でKubernetesを実行する 6 http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/
5.4 KubernetesクラスタとNode 7 # 5.4 kubectl get nodes
5.6 Pod YAMLについて補足 8 配列 ハッシュ - A - B
- - C-1 - C-2 A: a B: b C: C-1: c1 C-2: c2 [“A”, “B”, [“C-1”, “C-2”]] {“A” => “a”, “B” => “b”, “C” => {“C-1” => “c1”, “C-2” => “c2”}}
5.6 Pod YAMLのサンプル 9 https://magazine.rubyist.net/articles/0009/0009-YAML.html
5.6 Pod 10 # 5.6.1 # simple-pod.yml apiVersion: v1 kind:
Pod metadata: name: simple-echo spec: containers: - name: nginx image: gihyodocker/nginx-proxy:latest env: - name: BACKEND_HOST value: localhost:8000 ports: - containerPort: 80 - name: echo image: gihyodocker/echo:latest ports: - containerPort: 8080
5.6 Pod 11 # 5.6.1 kubectl apply -f simple-pod.yml kubectl
get pod kubectl exec -it simple-echo sh -c nginx kubectl logs -f simple-echo -c echo kubectl delete pod simple-echo kubectl delete -f simple-pod.yml
5.7 ReplicaSet 12 # 5.7 # simple-replicaset.yml apiVersion: apps/v1 kind:
ReplicaSet metadata: name: echo labels: app: echo spec: replicas: 3 selector: matchLabels: app: echo template: metadata: labels: app: echo spec: containers: - name: nginx image: gihyodocker/nginx-proxy:latest env: - name: BACKEND_HOST value: localhost:8080 ports: - containerPort: 80 - name: echo image: gihyodocker/echo:latest ports: - containerPort: 8080
5.7 ReplicaSet 13 # 5.6.1 kubectl apply -f simple-replicaset.yml kubectl
delete -f simple-replicaset.yml
5.8 Deployment 14 # 5.8 # simple-deployment.yml apiVersion: apps/v1 kind:
Deployment metadata: name: echo labels: app: echo spec: replicas: 3 selector: matchLabels: app: echo template: metadata: labels: app: echo spec: containers: - name: nginx image: gihyodocker/nginx-proxy:latest env: - name: BACKEND_HOST value: localhost:8000 ports: - containerPort: 80 - name: echo image: gihyodocker/echo:latest ports: - containerPort: 8080
5.8 Deployment 15 # 5.8.1 kubectl apply -f simple-deployment.yml --record
kubectl get pod,replicaset,deployment --selector app=echo kubectl rollout history deployment echo # 5.8.2 kubectl rollout history deployment echo --revision=2 kubectl rollout history deployment echo --revision=3 kubectl rollout undo deployment echo kubectl delete -f simple-deployment.yml
# 5.9 # simple-replicaset-with-label.yml apiVersion: apps/v1 kind: ReplicaSet metadata: name:
echo-spring labels: app: echo release: spring spec: replicas: 3 selector: matchLabels: app: echo release: spring template: metadata: labels: app: echo release: spring 5.9 Services 16 spec: containers: - name: nginx image: gihyodocker/nginx-proxy:latest env: - name: BACKEND_HOST value: localhost:8000 ports: - containerPort: 80 - name: echo image: gihyodocker/echo:latest ports: - containerPort: 8080 --- apiVersion: apps/v1 kind: ReplicaSet metadata: name: echo-summer labels: app: echo release: summer ...つづく
5.9 Services 17 # 5.9 kubectl apply -f simple-replicaset-with-label.yml kubectl
get pod -l app=echo -l release=spring kubectl get pod -l app=echo -l release=summer kubectl apply -f simple-service.yml kubectl get svc echo kubectl run -i --rm --tty debug --image=gihyodocker/fundamental:0.1.0 --restart=Never -- bash -il kubectl logs -f echo-summer-8qxmg -c echo
5.10 Ingress • L4バランサー ◦ IPアドレスとポート番号による負 荷分散 • L7バランサー ◦
URLやHTTPヘッダーで負荷分 散 18 https://academy.gmocloud.com/qa/20170810/4591
5.10 Ingress 19 # 5.10 kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/nginx-0.16.2/deploy/mandatory.yaml kubectl
apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/nginx-0.16.2/deploy/provider/cloud-generic.yaml kubectl -n ingress-nginx get service,pod # 5.10.2 kubectl apply -f simple-service.yml kubectl get ingress curl http://localhost -H 'Host: ch05.gihyo.local'