migrate your traditional vm-based clusters to containers

26
Migrate your traditional VMbased Clusters to Containers Arun Gupta, @arungupta Docker Captain, Java Champion

Upload: arun-gupta

Post on 13-Apr-2017

2.557 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Migrate your traditional VM-based Clusters to Containers

Migrate  your  traditional  VM-­‐based  Clusters  to  Containers

Arun Gupta, @arungupta Docker Captain, Java Champion

Page 2: Migrate your traditional VM-based Clusters to Containers

©2016  Couchbase  Inc.

Amazon  Web  Services

2

Page 3: Migrate your traditional VM-based Clusters to Containers

©2016  Couchbase  Inc.

Amazon  Web  Services

2

• Create VM 1, 2, 3

VM 1 VM 2 VM 3

Page 4: Migrate your traditional VM-based Clusters to Containers

©2016  Couchbase  Inc.

Amazon  Web  Services

2

• Create VM 1, 2, 3• Add Couchbase 1, 2, 3

VM 1 VM 2 VM 3

Page 5: Migrate your traditional VM-based Clusters to Containers

©2016  Couchbase  Inc.

Cluster

Amazon  Web  Services

2

• Create VM 1, 2, 3• Add Couchbase 1, 2, 3• Create cluster

VM 1 VM 2 VM 3

Page 6: Migrate your traditional VM-based Clusters to Containers

©2016  Couchbase  Inc.

Cluster

Amazon  Web  Services

2

• Create VM 1, 2, 3• Add Couchbase 1, 2, 3• Create cluster• Rebalance cluster

VM 1 VM 2 VM 3

Page 7: Migrate your traditional VM-based Clusters to Containers

©2016  Couchbase  Inc.

Docker  Machine  +  Compose  +  Swarm

3

Page 8: Migrate your traditional VM-based Clusters to Containers

©2016  Couchbase  Inc.

Docker  Machine  +  Compose  +  Swarm

3

Swarm Master

Swarm Node 01

Swarm Node 02

Consul Machine

Page 9: Migrate your traditional VM-based Clusters to Containers

©2016  Couchbase  Inc.

Docker  Machine  +  Compose  +  Swarm

3

Swarm Master

Swarm Node 01

Swarm Node 02

Consul Machine

Page 10: Migrate your traditional VM-based Clusters to Containers

©2016  Couchbase  Inc.

Docker  Machine  +  Compose  +  Swarm

3

Swarm Master

Swarm Node 01

Swarm Node 02

Consul Machine

version: "2"services: db: image: arungupta/couchbase network_mode: "host" ports: - 8091:8091 - 8092:8092 - 8093:8093 - 11210:11210

Page 11: Migrate your traditional VM-based Clusters to Containers

©2016  Couchbase  Inc.

Docker  Machine  +  Compose  +  Swarm

3

Swarm Master

Swarm Node 01

Swarm Node 02

Consul Machine

version: "2"services: db: image: arungupta/couchbase network_mode: "host" ports: - 8091:8091 - 8092:8092 - 8093:8093 - 11210:11210

scale db=2docker-compose

Page 12: Migrate your traditional VM-based Clusters to Containers

©2016  Couchbase  Inc.

Docker  Machine  +  Compose  +  Swarm

3

Swarm Master

Swarm Node 01

Swarm Node 02

Consul Machine

version: "2"services: db: image: arungupta/couchbase network_mode: "host" ports: - 8091:8091 - 8092:8092 - 8093:8093 - 11210:11210

scale db=2docker-compose

Page 13: Migrate your traditional VM-based Clusters to Containers

©2016  Couchbase  Inc.

Docker  Machine  +  Compose  +  Swarm

3

Swarm Master

Swarm Node 01

Swarm Node 02

Consul Machine

version: "2"services: db: image: arungupta/couchbase network_mode: "host" ports: - 8091:8091 - 8092:8092 - 8093:8093 - 11210:11210

scale db=2docker-compose

Page 14: Migrate your traditional VM-based Clusters to Containers

©2016  Couchbase  Inc.

Kubernetes

4

Page 15: Migrate your traditional VM-based Clusters to Containers

©2016  Couchbase  Inc.

Kubernetes

4

Master

Minion 1

Minion 3

Minion 2

Minion 4

Page 16: Migrate your traditional VM-based Clusters to Containers

©2016  Couchbase  Inc.

Kubernetes

4

Master

Minion 1

Minion 3

Minion 2

Minion 4

apiVersion: v1 kind: ReplicationController metadata: name: couchbase-controller spec: replicas: 1 selector: app: couchbase-master-pod template: metadata: labels: app: couchbase-master-pod spec: containers: - name: couchbase-master image: arungupta/couchbase env: - name: TYPE value: MASTER ports: - containerPort: 8091 ---- apiVersion: v1 kind: Service metadata: name: couchbase-service labels: app: couchbase-master-service spec: ports: - port: 8091 selector: app: couchbase-master-pod

Page 17: Migrate your traditional VM-based Clusters to Containers

©2016  Couchbase  Inc.

Kubernetes

4

Master

Minion 1

Minion 3

Minion 2

Minion 4

apiVersion: v1 kind: ReplicationController metadata: name: couchbase-controller spec: replicas: 1 selector: app: couchbase-master-pod template: metadata: labels: app: couchbase-master-pod spec: containers: - name: couchbase-master image: arungupta/couchbase env: - name: TYPE value: MASTER ports: - containerPort: 8091 ---- apiVersion: v1 kind: Service metadata: name: couchbase-service labels: app: couchbase-master-service spec: ports: - port: 8091 selector: app: couchbase-master-pod

Page 18: Migrate your traditional VM-based Clusters to Containers

©2016  Couchbase  Inc.

Kubernetes

4

Master

Minion 1

Minion 3

Minion 2

Minion 4

apiVersion: v1 kind: ReplicationController metadata: name: couchbase-controller spec: replicas: 1 selector: app: couchbase-master-pod template: metadata: labels: app: couchbase-master-pod spec: containers: - name: couchbase-master image: arungupta/couchbase env: - name: TYPE value: MASTER ports: - containerPort: 8091 ---- apiVersion: v1 kind: Service metadata: name: couchbase-service labels: app: couchbase-master-service spec: ports: - port: 8091 selector: app: couchbase-master-pod

env: - name: TYPE value: WORKER - name: COUCHBASE_MASTER value: SERVICE_IP_OF_MASTER - name: AUTO_REBALANCE value: true

Page 19: Migrate your traditional VM-based Clusters to Containers

©2016  Couchbase  Inc.

Kubernetes

4

Master

Minion 1

Minion 3

Minion 2

Minion 4

apiVersion: v1 kind: ReplicationController metadata: name: couchbase-controller spec: replicas: 1 selector: app: couchbase-master-pod template: metadata: labels: app: couchbase-master-pod spec: containers: - name: couchbase-master image: arungupta/couchbase env: - name: TYPE value: MASTER ports: - containerPort: 8091 ---- apiVersion: v1 kind: Service metadata: name: couchbase-service labels: app: couchbase-master-service spec: ports: - port: 8091 selector: app: couchbase-master-pod

scale replicas=2kubectl env:

- name: TYPE value: WORKER - name: COUCHBASE_MASTER value: SERVICE_IP_OF_MASTER - name: AUTO_REBALANCE value: true

Page 20: Migrate your traditional VM-based Clusters to Containers

©2016  Couchbase  Inc.

DC/OS

5

Page 21: Migrate your traditional VM-based Clusters to Containers

©2016  Couchbase  Inc.

DC/OS

5

Master

Slave 1

Slave 3

Slave 2

Page 22: Migrate your traditional VM-based Clusters to Containers

©2016  Couchbase  Inc.

DC/OS

5

Master

Slave 1

Slave 3

Slave 2

Page 23: Migrate your traditional VM-based Clusters to Containers

©2016  Couchbase  Inc.

DC/OS

5

Master

Slave 1

Slave 3

Slave 2

{ "id": "couchbase-mesos", "container": { "type": "DOCKER", "docker": { "image": "arungupta/couchbase", "network": "BRIDGE", "portMappings": [ { "hostPort": 0, "containerPort": 8091, "servicePort": 8091 }, { "hostPort": 0, "containerPort": 8092, "servicePort": 8092 }, { "hostPort": 0, "containerPort": 8093, "servicePort": 8093 }, { "hostPort": 0, "containerPort": 11210, "servicePort": 11210 } ], "forcePullImage":true } }, "instances": 1, "cpus": 2.0, "mem": 2048, "labels":{ "HAPROXY_GROUP":"external" } }

Page 24: Migrate your traditional VM-based Clusters to Containers

©2016  Couchbase  Inc.

DC/OS

5

Master

Slave 1

Slave 3

Slave 2

{ "id": "couchbase-mesos", "container": { "type": "DOCKER", "docker": { "image": "arungupta/couchbase", "network": "BRIDGE", "portMappings": [ { "hostPort": 0, "containerPort": 8091, "servicePort": 8091 }, { "hostPort": 0, "containerPort": 8092, "servicePort": 8092 }, { "hostPort": 0, "containerPort": 8093, "servicePort": 8093 }, { "hostPort": 0, "containerPort": 11210, "servicePort": 11210 } ], "forcePullImage":true } }, "instances": 1, "cpus": 2.0, "mem": 2048, "labels":{ "HAPROXY_GROUP":"external" } }

Marathon

Page 25: Migrate your traditional VM-based Clusters to Containers

©2016  Couchbase  Inc.

DC/OS

5

Master

Slave 1

Slave 3

Slave 2

{ "id": "couchbase-mesos", "container": { "type": "DOCKER", "docker": { "image": "arungupta/couchbase", "network": "BRIDGE", "portMappings": [ { "hostPort": 0, "containerPort": 8091, "servicePort": 8091 }, { "hostPort": 0, "containerPort": 8092, "servicePort": 8092 }, { "hostPort": 0, "containerPort": 8093, "servicePort": 8093 }, { "hostPort": 0, "containerPort": 11210, "servicePort": 11210 } ], "forcePullImage":true } }, "instances": 1, "cpus": 2.0, "mem": 2048, "labels":{ "HAPROXY_GROUP":"external" } }

app update instances=2Marathon Marathon

dcos

Page 26: Migrate your traditional VM-based Clusters to Containers

©2016  Couchbase  Inc.

References

▪Docker: docker.io – Interlock: https://github.com/ehazlett/interlock

▪Kubernetes: kubernetes.io ▪DC/OS: dcos.io ▪OpenShift: openshift.io ▪Couchbase on Containers: couchbase.com/containers

6