Slide 1

Slide 1 text

Kubernetes 動かしてみた hashimoto syuta [email protected]

Slide 2

Slide 2 text

2 今日の内容

Slide 3

Slide 3 text

自己紹介

Slide 4

Slide 4 text

4 橋本 修太 • openSUSE ユーザ会で主に活動中 • その他、小江戸 LUG などの LUG に出没 • 最近は途上国関連のイベントにも参加 Twitter @syuta_openSUSE FB: syutah 海に出よう >

Slide 5

Slide 5 text

Kubernetes とは?

Slide 6

Slide 6 text

6 Kubernetes •コンテナの実行を管理 ‒コンテナを動かす ‒スケールアウト ‒自動再起動

Slide 7

Slide 7 text

7 Kubernetes で出来ないこと •イメージの作成 •イメージの管理 イメージとコンテナについてはこれ までのお話を参照してください

Slide 8

Slide 8 text

8 ちなみに •イメージの作成   → Docker 等で可能 •イメージの管理   → Docker Hub や     Portus 等で可能

Slide 9

Slide 9 text

物理的な構成

Slide 10

Slide 10 text

10 Kubernetes はクラスタ構成 Master 全体を管理する(管理用のコンテナが走っている) Node 実際にコンテナが走る Kubernetes クラスタ

Slide 11

Slide 11 text

11 Kubic インストールすればすぐに Kubernetes クラ スタになるディストリビューションも存在 インストール方法の 記事乗ってます

Slide 12

Slide 12 text

ユーザー視点

Slide 13

Slide 13 text

13 ユーザー視点 Node1 Node2 POD A POD A POD B POD D Service

Slide 14

Slide 14 text

14 Pod & Service •Pod Kubernetes でコンテナを動かす 時の単位 ほぼコンテナとイコール (ただ し、複数コンテナを 1Pod に配置 する事もできる)

Slide 15

Slide 15 text

15 Pod & Service •Service pod へのアクセスを制御 pod は Kubernetes が自動生成し たりするので、 IP が変わってしま う。そこで Service が一元管理

Slide 16

Slide 16 text

Pod を作成してみよう

Slide 17

Slide 17 text

17 Pod を作成してみよう $ kubectl run nginx-test --image=nginx あるいは $ kubectl apply -f nginxtest.yaml

Slide 18

Slide 18 text

18 Pod を作成してみよう apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.7.9 ports: - containerPort: 80 実際の yaml ファイル

Slide 19

Slide 19 text

19 Pod を作成してみよう deployment replicaset pod pod 生成・管理 生成・管理 ローリングアップデート 等、デプロイを管理 pod の数 (replica) を管理 でもって、 pod

Slide 20

Slide 20 text

20 Pod を作成してみよう 情報取得 $ kubectl get deployment $ kubectl get replicaset $ kubectl get pod 詳細情報取得 $ kubectl describe deployment/nginx-test

Slide 21

Slide 21 text

21 Pod を作成してみよう pod (コンテナ)のログ取得 $ kubectl logs 【 pod 名】 pod (コンテナ)に入る $kubectl exec -it 【 pod 名】 bash

Slide 22

Slide 22 text

Service を 作成してみよう

Slide 23

Slide 23 text

23 Service を作成してみよう $ kubectl expose deployment/nginx-test --type=”NodePort” --port 80 あるいは $ kubectl apply -f nginxtest-service.yaml

Slide 24

Slide 24 text

24 Service を作成してみよう apiVersion: v1 kind: Service metadata: name: nginx-nodeport spec: type: NodePort ports: - port: 80 protocol: TCP targetPort: 80 selector: app: nginx 実際の yaml ファイル

Slide 25

Slide 25 text

まだまだある

Slide 26

Slide 26 text

26 Volume • Persistent Volume と Persistent Volume Claim • Service Catalog • OpenSDS

Slide 27

Slide 27 text

27 その他のコンポーネント • DaemonSet • StatefulSet

Slide 28

Slide 28 text

Questions?

Slide 29

Slide 29 text

Thank you. Join the conversation, contribute & have a lot of fun! www.opensuse.org

Slide 30

Slide 30 text

30 Have a Lot of Fun, and Join Us At: www.opensuse.org

Slide 31

Slide 31 text

General Disclaimer This document is not to be construed as a promise by any participating organisation to develop, deliver, or market a product. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. openSUSE makes no representations or warranties with respect to the contents of this document, and specifically disclaims any express or implied warranties of merchantability or fitness for any particular purpose. The development, release, and timing of features or functionality described for openSUSE products remains at the sole discretion of openSUSE. Further, openSUSE reserves the right to revise this document and to make changes to its content, at any time, without obligation to notify any person or entity of such revisions or changes. All openSUSE marks referenced in this presentation are trademarks or registered trademarks of SUSE LLC, in the United States and other countries. All third-party trademarks are the property of their respective owners. License This slide deck is licensed under the Creative Commons Attribution-ShareAlike 4.0 International license. It can be shared and adapted for any purpose (even commercially) as long as Attribution is given and any derivative work is distributed under the same license. Details can be found at https://creativecommons.org/licenses/by-sa/4.0/ Credits Template Richard Brown [email protected] Design & Inspiration openSUSE Design Team http://opensuse.github.io/branding- guidelines/