2. Docker れ(Mac)
Install Docker for Mac
To download Docker for Mac, head to Docker Hub.
https://download.docker.com/mac/stable/Docker.dmg
Double-click Docker.dmg to open the installer, then drag Moby the whale to the
Applications folder.
Double-click Docker.app in the Applications folder to start Docker.
3. Hello World 貉企 ろ
$ docker run busybox echo "Hello World"
Unable to find image 'busybox:latest' locally
latest: Pulling from library/busybox
57c14dd66db0: Pull complete
Digest: sha256:7964ad52e396a6e045c39b5a44438424ac52e12e4d5a25d94895f2058cb863a0
Status: Downloaded newer image for busybox:latest
Hello World
$docker run busybox echo "Hello World"
Hello World
4. 螳 Node.js app
$ cat <<'EOF' > app.js
const http = require('http');
const os = require('os');
console.log("Kubia server starting...");
var handler = function(request, response) {
console.log("Received request from " + request.connection.remoteAddress);
response.writeHead(200);
response.end("You've hit " + os.hostname() + "n");
};
var www = http.createServer(handler);
www.listen(8080);
EOF
5. Node.js app ろ
$ node app.js
Kubia server starting...
Received request from ::1
$ curl http://localhost:8080/
You've hit users-MacBook-Pro.local
8. 企語 layer 危危蠍
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
kubia latest 368abcc4bef2 3 days ago 660MB
busybox latest 3a093384ac30 13 days ago 1.2MB
node 7 d9aed20b68a4 17 months ago 660MB
10. ろ譴 貉企
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED
STATUS PORTS NAMES
831a05a16037 kubia "node app.js" 3 days ago
Up 8 seconds 0.0.0.0:8080->8080/tcp kubia-container
$ curl localhost:8080
You've hit 831a05a16037
22. cluster 覲
$ kubectl cluster-info
Kubernetes master is running at https://192.168.99.101:8443
KubeDNS is running at
https://192.168.99.101:8443/api/v1/namespaces/kube-system/services/kube-dns:dns
/proxy
23. Using a hosted Kubernetes cluster with
Google Kubernetes Engine
...
24. Creating a Kubernetes clusterwith three nodes-
using GKE
$ gcloud container clusters create kubia --num-nodes 3 --machine-type f1-micro
25. cluster nodes 覈襦朱 cluster
$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
minikube Ready master 2d v1.12.4
41. Application れ朱
$ kubectl get replicationcontrollers
NAME DESIRED CURRENT READY AGE
kubia 1 1 1 33m
$ kubectl scale rc kubia --replicas=3
replicationcontroller "kubia" scaled
$ k get rc
NAME DESIRED CURRENT READY AGE
kubia 3 3 2 35m
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
kubia-57zlr 1/1 Running 0 1m
kubia-k99gg 1/1 Running 0 36m
kubia-sl82g 1/1 Running 0 1m
42. 觜 豌 覈 豌讌
$ curl http://192.168.99.101:30701/
You've hit kubia-57zlr
$ curl http://192.168.99.101:30701/
You've hit kubia-k99gg
$ curl http://192.168.99.101:30701/
You've hit kubia-k99gg
$ curl http://192.168.99.101:30701/
You've hit kubia-sl82g