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超入門 with java
Search
Yasunari Tanaka
October 27, 2017
Technology
180
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Kubernetes超入門 with java
2017.10.27 広島Javaユーザーグループ で行ったKubernetes ハンズオン資料です。
Yasunari Tanaka
October 27, 2017
More Decks by Yasunari Tanaka
See All by Yasunari Tanaka
MicroProfile OpenTracing with Helidon
yasu7ri
2
220
Serverlessで行ってみよ~
yasu7ri
0
1.2k
DevOpsサンプルアプリをGitLabからGKEへデプロイしてみた
yasu7ri
1
300
知識ゼロからRancher2.0に触れてみた
yasu7ri
1
470
CloudGarageでServerlessだ!
yasu7ri
3
4.7k
Other Decks in Technology
See All in Technology
2026-09-18 gotanda.sre Terraformで複数環境作ったり、複数Stateに分割したりそれとTerragrunt / Terraform multi envs and multi states
masasuzu
1
400
OpenTelemetryのメトリクスをCloudWatchに送ってPromQLで見てみた
ota1022
0
150
アクセスキーこわい やめかたと漏らさない工夫
sassssan68
1
290
アプリをもっと"iOSアプリっぽく"する小さな工夫 / Small Touches That Make Your App Feel More Like an iOS App
matsuji
2
910
20260912_スクフェス三河
kgnkhkr
0
380
2026_devsumi_ozono.pdf
o3
3
510
LLMに渡さなかった仕事
nanaism
0
250
SREは、MCPとAutopilotをこう使え!
kazumax55
2
830
研究開発部の紹介 / Sansan R&D Profile
sansan33
PRO
5
25k
AI時代の「技術的負債」の変質ー概念の終焉と再解釈、エージェントと共に向かう先
nwiizo
0
2.7k
越境するなら専門用語を使うな高校校歌 / If you wanna cross border, you shouldn't use jargon
vtryo
0
140
Claude Codeを「使うほど育つ」AI秘書にするノウハウ
minorun365
PRO
30
25k
Featured
See All Featured
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
410
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
690
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
6.2k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3.1k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
280
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.2k
The SEO Collaboration Effect
kristinabergwall1
1
560
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Ten Tips & Tricks for a 🌱 transition
stuffmc
1
230
Transcript
Kubernetes with Java Kubernetes Java #hirojug
1 - - $! +# &(# - ,%+&",
Java),,*,% '* Twitter-@7richi
2 5:)Oracle Code Japan Tour in Hiroshima*;)Cloud Native Java EE*LMJRT7KubernetesD14SFPIVNETHNQD56&,4
.UUU Kubernetes:%16+=@ .-544>'3; 7.CB4-+ =@7/6,9-54;. -54(W?>X 307'Kubernetes:%2A 9;8 ;OTKGTD "16Kubernetes<!#14,8 ,=2( $;
1.
4 ▪ Kubernetes.+CE7A-Kubernetes5%)Spring Boot* %'REST API5%)9D=?6E8<>BE;@D5&4 ▪:EA – Kubernetes.
– CE7A0Kubernetes.#43"-,4 – Kubernetes5%',9D=?6E8<>BE;@D. ▪%,!$+ – 9D=?(Docker)-&4 – Spring Boot. . – REST API-(!) . +:EA $$%,!+ 12/Java+/ ,!.*/
5 -2/=5 ▪Kubernetes& ▪<>1; & ▪8=30= – Pod#&69<. – Replica
Set+69<. – Deployment+69<. – Service& – Service+Blue/Green Deployment ▪ – 0>9=4:7>2018? ▪ – *# )!$(% – "',
2. Kubernetes
7 ▪miniKube – Windows exe (minikube-windows-amd64.exe) https://github.com/kubernetes/minikube/releases
8 mOp_uZzizJ n[xFDockerNG<IB=LYxbe"N =L[\bo{YxbeUzX\dvz[rxazu|1 GoogleA-/+:M@5LYxbeWs\_[\bo2Borg3AF gShSN/;@-:M>1GApachesQ]x\A, :M@5L Uzlx^z\^kdSTOA4L1 nQWwZzj\NEclwQ0O`lczd=L$B;@0YxbeF Uzd\Xzu0
Blue Green Deployment 0 Rolling Update DCF$ N7@5L1 ?DHE2Kubernetes3G0Vt[q(A2%F!32 #y,#3B56 94LB:M12k8s3B:M'*:ML9 51 {8GK8KsF.F N&;@5L| )HG2WzmzfPb\3J2WRifPb\3} KubernetesBG
9 ▪2014 66 ▪2015 76.5*141.0335+ ▪2015 76Linux Foundation&Cloud Native Computing
Fou ndation(CNCF)% (AT&TCiscoCoreOSDockerIBMIntelMicrosoftRed HatVM ware$#&% () ▪2017 86AWSCNCF%04.5&/2,- " )'!& $
10 ]udh+O NQR4 Wlq\v_ouOeltXP%N>4) %N*;SQ:NMGF5A<A1O/$JP,OWlq\v_ouU. @ CIHO^vj`KAIBS-=8S5w!NmX[t^vj`%MW ltvbJPxE?J]udh0O.= KMR2O&ML/$3 U(AF
4,]udhU'#BS_`dn=-KMGF5 6AWS76Microsoft Azure76Google Cloud Platform76IBM Bluemix7ML O-[pYgltiXav=CNCFONMGFNQR4"OK?T]u dhZv\`fsv_oucvrKAIKubernetesPekV[fK9;SN MRHH8S ▪KubernetesOZv\`fsv_oucvr Docker Swarm4Amazon EC2 Container ServiceML=8S MD]udhZv\`fsv_oucvr=-NMGFO<
11 ▪1%PGOCa frgp} – dy%YGCPAAWSLBJKXk8s_;GK7A='H]M(RUM `N)&GOC ▪jru2PGOCjru1% – jru2%Q8 PZ\Open Container
InitiativeE<WKC]j ru#LB^SDockerQjru2LXZC ▪3zmtPjru_syc – NQzmtPNQjru_>H]D_@0 ▪jru?Qvqt g,$ 6!XV – k xmsbmew +Q- ▪jruQ"*5 – jruE`I[Ajru_. L4: ▪jruQ9/ – -Q3jruTQagnmwlh- ▪jruQo mai l~ – jru PCPUo mY{| o mQ - KubernetesR_GKF^]QD
12 ▪ % #Ingress $ Kubernetes Cluster
Node Pod " ! Service Ingress internet Node Pod " ! Node Pod " ! Service
13 ▪Node/Cluster Node^cIk8sbvnpVlYgbVM`KT24w bR^J k8sn94Vl=dIxN) Vl \bvNRmj Node]@SmlJNodebHnCliuter^e ▪Pod k8s]bpb,!JPodc bvbH]INode
a"FSmlk8s-b0$J Podb3#c&TYvc \+aUNodeapSmlJRm aik<VlA*b{zv]1%SmYZbouy ]LKnBZQhVPTZbH^T\p/l zry^ouyIouyb^ sq `_b:W – Pod bvclocalhost;6]D ]Ol – EMj8(Podfcos{zc/`K – Label:k8s]94Sm\Kl|zc>a[O?7a.IpS mlNXbGa~`N?7a'jmlIXmjnBZQhVPVlY gPoda T\}tnVlR^N/l Kubernetesb5C[1/3]
14 ▪Service $Pod?8; IPK]hVJ G;Hk8s@"<.!? ServiceB@KRWV3Pod?G 5FIH@<ik]_ejT@?H #1/k8s<ATk`V[LVQ_fJ9H:@fXkV=7I;0H – Service@
- ▪ ClusterIP:ReVY)?Tk`VJ*8C9/6@J(9H=.ReVY2F@ DTk`V?KRWV<4C9([aPg\) ▪ NodePort: ^k]IP?+>ck\<Tk`VJ*8C9/ <NodeIP>l<NodePort>J%9H6=?EG.ReVY2FNodePortTk`V? KRWV<4C9 ▪ LoadBalancer:ReN]bi_MZ@ik]_ejTJ8;)?Tk`VJ* 8C9(minikubeA,) ▪ ExternalName:DNS@CNAMEhSk]J&9H6=?EG.ReVY) 5@OM fKVJ9H/6I?A_kUdj1.7@kube-dns3% Kubernetes@'[2/3]
15 ▪Ingress IngressYServiceW[]ICAdServiceW{joNaDHTTP vx|nW- MR8LbREa,CL7SXURLyqW_a~ sfl^SSL43 /VUX<]7FaD\PCIngressYk8sH2M REa0W_QR*6T8HGcaCGCPSYGCPXCAWSSYAWS X0W QPS{joH
Lba ▪Replica Set PodX{}i$PodXmsw$d5!/=Na*6DmswH" MP{}i$_`]VE Y%PWmswd? MCFNJRa Ymswd BM{}i$d5!Na ▪Deployment Pod^Replication SetsX:er{tu*6d#DDeploymenth zpgkuS(Na.d;@NbZDeployment ControllerH9+M P.W&MRKba OXW]Kubernetes'X)C1>H$Na KubernetesX1>[3/3]
3.
17 Minikube"k8s)#& %'8=.=! $ ;=*:7/=<!VM k8+901!,<24) '$ !-=6(Kubernetes
Master)5=3!k8s+901) (' >Minikube " Ingress" ? Minikube" ;=*:7/=< (Linux,Mac OS,Windows) VM(VirtualMachine) Kubernetes(minikube) Kubernetes Master Node (1!#)
18 ▪ – virtualBox 4Q<BRO#1(0"* ▪minikube-=@B3@H – miniKube-?5QPRC ▪ Windows
- exe (minikube-windows-amd64.exe) https://github.com/kubernetes/minikube/releases – minikube- ▪ minikube-windows-amd64.exe2minikube.exe *NDRJ$(F<-'&G7 O?,! ▪ AG7OB- vm driver 2 VirtualBox ,%0&.-9IQC – kubectl 4Q<BRO#1(+-)6MRK@=R; #10 – #1&URL / kubectl.exe 2?5QPRC$(F<-'&G7O?, – vm driver 2 VirtualBox ,%0&.9IQC2 %0 ▪Kubernetes8M<>- – -9IQC)8M<>2%0 – -9IQC):RERER;LQ2 &/ Windows,kubernetes 2%0 $ minikube config set vm-driver virtualbox $ minikube start $ minikube version
4.
20 /8*#8 Docker6()-4 Spring Boot REST APIDocker"29(! Kubernetes&8+.#9%)- 69'38!
▪Docker6()-4 – docker.io/uls555/getting-started-k8s-with-java ▪,07" /8*#8 Docker Hub 79$51'98 Docker Image REST API minikube push pull
21 REST API REST API Docker Hub
Docker Image REST API minikube
22 /%-Pod,6 4+Pod,@EL86#'04J>M< - GCD9<A).5YAML ($4 ▪Pod, ) – ,
(pod.yaml6 – Pod6 ▪Pod, – ",Pod-:I<?,EI8FMAIP7BK<#!&'*,(!3- 7:=<* – Dashboard(1#'02NURL:http://192.168.99.100:30000O Pod(,@EL8[1/2] apiVersion: v1 kind: Pod metadata: name: rest-api spec: containers: - image: docker.io/uls555/getting-started-k8s-with-java:v1 imagePullPolicy: Always name: rest-api $ kubectl create -f pod.yaml $ kubectl get pods NAME READY STATUS RESTARTS AGE rest-api 0/1 ContainerCreating 0 1m 8HM;,
23 nPod Pod [2/2] $ kubectl delete pod rest-api
24 Pod/ "$Pod "$+, /%$ +*) !.*Replica Set/"&+Pod/ #-
▪Replica Set+ ( – + 'replicaset.yaml/ – Replica Set/ Replica Set/"$1230[1/2] apiVersion: extensions/v1beta1 kind: ReplicaSet metadata: name: rest-api-rs spec: replicas: 3 template: metadata: labels: app: my-rest-api spec: containers: - image: docker.io/uls555/getting-started-k8s-with-java:v1 imagePullPolicy: Always name: rest-api $ kubectl create -f replicaset.yaml #-Pod+ Pod+
25 ▪Pod ▪Pod Replica SetPod " Pod"
Pod – Pod ▪Replica Set Replica Set" $%&#[2/2] $ kubectl get pod NAME READY STATUS RESTARTS AGE rest-api-rs-6xpqf 1/1 Running 0 1m rest-api-rs-m1x43 1/1 Running 0 1m rest-api-rs-pbsmk 1/1 Running 0 1m $ kubectl delete pod rest-api-rs-m1x43 $ kubectl get pod NAME READY STATUS RESTARTS AGE rest-api-rs-6xpqf 1/1 Running 0 4m rest-api-rs-m1x43 1/1 Terminating 0 4m rest-api-rs-n92wz 0/1 ContainerCreating 0 5s rest-api-rs-pbsmk 1/1 Running 0 4m !Pod !Pod $ kubectl delete replicaset rest-api-rs
26 Replica Set0!/$ k8s&-%Deployment0 !/$&,.6;?2' k8s&/"+'9A4=@& & /$/ ▪Deployment'
$6;?2 – ' #deployment.yaml0 – 6;?2 Deployment0 "6;?2[1/3] apiVersion: apps/v1beta1 kind: Deployment metadata: name: rest-api-dep spec: replicas: 3 template: metadata: labels: app: my-rest-api spec: containers: - image: docker.io/uls555/getting-started-k8s-with-java:v1 imagePullPolicy: Always name: rest-api <8:357:12>( RepulicsSet$)* $ kubectl create -f deployment.yaml
27 ▪Pod ▪Deployment – Replicas 4
Deployment [2/3] $ kubectl get pods NAME READY STATUS RESTARTS AGE rest-api-rs-6xpqf 1/1 Running 1 9h rest-api-rs-n92wz 1/1 Running 1 9h rest-api-rs-pbsmk 1/1 Running 1 9h apiVersion: apps/v1beta1 kind: Deployment metadata: name: rest-api-dep spec: replicas: 4 template: metadata: labels: app: my-rest-api spec: containers: - image: docker.io/uls555/getting-started-k8s-with-java:v1 imagePullPolicy: Always name: rest-api replica 4
28 ▪Deployment – Deployment ▪Pod – Pod14 Deployment
[3/3] $ kubectl get pods NAME READY STATUS RESTARTS AGE rest-api-rs-6xpqf 1/1 Running 1 9h rest-api-rs-9b0sl 1/1 Running 0 10s rest-api-rs-fbcdf 0/1 ContainerCreating 0 10s rest-api-rs-pbsmk 1/1 Running 1 9h $ kubectl apply -f deployment.yaml
29 Service7 (,&62- (*Pod7+0/(*8=;97 5..3/#407Pod/)5 ▪Service0 . – 0 -service.yaml7
– Service7 ▪Service0 Service0 [1/3] kind: Service apiVersion: v1 metadata: name: rest-api-service spec: type: NodePort selector: app: my-rest-api ports: - port: 8080 targetPort: 8080 $ kubectl create -f service.yaml Service01Nodeport7)5 minikube-1LoadBalancer1 Pod0Lavel/ app:my-rest-api!$ '6,"5Pod7%5 )5Service0<=:.Pod0<=:7 %5 $ kubectl get services NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes 10.0.0.1 <none> 443/TCP 11h rest-api-service 10.0.0.51 <nodes> 8080:31372/TCP 1m
30 ▪ Service – Node IP –
▪Deployment – v2 Service [2/3] $ minikube ip 192.168.99.100 http://192.168.99.100:31372 apiVersion: apps/v1beta1 kind: Deployment metadata: name: rest-api-dep spec: replicas: 4 template: metadata: labels: app: my-rest-api spec: containers: - image: docker.io/uls555/getting-started-k8s-with-java:v2 imagePullPolicy: Always name: rest-api v2
31 ▪Deployment – ▪ Deployment &)-'!"%+ #/ $*&0'
.0,/ $*&0' – ▪Deployment.0-($ – .0-($ – Service[3/3] $ kubectl apply -f deployment.yaml deployment "rest-api-dep" replaced $ curl 192.168.99.100:31372 {"message":"Hello World!","version":"v2"} $ kubectl rollout undo deployment/rest-api-dep deployment "rest-api-dep" rolled back $ curl 192.168.99.100:31372 {"message":"Hello World!","version":"v1"}
32 Deployment0 #.!'&:<9;31586<7+% )- ,/( Blue/Green Deployment*(0- +Service 0"-. .
▪)Deployment0 – * &deployment-v3.yaml0 – 68:2 Service0"$Blue/Green Deployment[1/2] apiVersion: apps/v1beta1 kind: Deployment metadata: name: rest-api-dep-v3 spec: replicas: 3 template: metadata: labels: app: my-rest-api-v3 spec: containers: - image: docker.io/uls555/getting-started-k8s-with-java:v1 imagePullPolicy: Always name: rest-api Deployment* '4 30v3) $ kubectl create –f deployment-v3.yaml
33 – Deployment ▪Service – ServicePod selector –
ServiceBlue/Green Deployment[2/2] $ kubectl get deployment NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE rest-api-dep 4 4 4 4 3h rest-api-dep-v3 4 4 4 4 23m kind: Service apiVersion: v1 metadata: name: rest-api-service spec: type: NodePort selector: app: my-rest-api-v3 ports: - port: 8080 targetPort: 8080 PodLavel app:my-rest-api-v3 Pod $ kubectl apply -f service.yaml service "rest-api-service" configured $ curl 192.168.99.100:31372 {"message":"Hello World!","version":"v3"}
5.
35 ▪minikube start%* – Node –
”.minikube”!("& minikube "%#'$* ) $ minikube stop $ minikube delete $ minikube start
36 > ▪ WEB1-5 – Using Kubernetes on Google
Container Engine https://www.slideshare.net/enakai/using-kubernetes-on-google-container-engine – Docker& %$2 @Kubernetes@ https://oss.sios.com/yorozu-blog/yorozu-20151216 – Docker0=46, )!(Kubernetes http://tech.uzabase.com/entry/2015/02/13/180743 – minikube Windows " Kubernetes , ) http://takaya030.hatenablog.com/entry/2017/04/30/191727 – kubernetes +)23-; 9-.<1?72'!&'! http://sssslide.com/speakerdeck.com/sgeengineer/kubernetesdebian-warukai-fa-sutairu- maikurosabisuziyanakutemoiiziyanai – Kubernetes +*) http://qiita.com/t-yotsu/items/f565b2d788a3b98fe762 ▪ – 8</:9#%#Google Cloud Platform – WEB+DB-PRESS Vol.99