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
510
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
480
Backlog API x Zapier x Slack で お気づきだろうか!!!!
nagaakihoshi
0
1.3k
WEBサービス開発における仮説思考のための道具
nagaakihoshi
2
660
心理的安全性の 「持ちつ持たれつ」
nagaakihoshi
2
4.5k
レビューで 初心者インターンを 一人前に育てた話
nagaakihoshi
1
1.4k
Featured
See All Featured
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
The Cost Of JavaScript in 2023
addyosmani
55
10k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.7k
Done Done
chrislema
187
17k
Ten Tips & Tricks for a 🌱 transition
stuffmc
1
280
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.9k
What the history of the web can teach us about the future of AI
inesmontani
PRO
2
770
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Fireside Chat
paigeccino
43
4.1k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
730
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'