migrate your traditional vm-based clusters to containers
TRANSCRIPT
Migrate your traditional VM-‐based Clusters to Containers
Arun Gupta, @arungupta Docker Captain, Java Champion
©2016 Couchbase Inc.
Amazon Web Services
2
©2016 Couchbase Inc.
Amazon Web Services
2
• Create VM 1, 2, 3
VM 1 VM 2 VM 3
©2016 Couchbase Inc.
Amazon Web Services
2
• Create VM 1, 2, 3• Add Couchbase 1, 2, 3
VM 1 VM 2 VM 3
©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
©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
©2016 Couchbase Inc.
Docker Machine + Compose + Swarm
3
©2016 Couchbase Inc.
Docker Machine + Compose + Swarm
3
Swarm Master
Swarm Node 01
Swarm Node 02
Consul Machine
©2016 Couchbase Inc.
Docker Machine + Compose + Swarm
3
Swarm Master
Swarm Node 01
Swarm Node 02
Consul Machine
©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
©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
©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
©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
©2016 Couchbase Inc.
Kubernetes
4
©2016 Couchbase Inc.
Kubernetes
4
Master
Minion 1
Minion 3
Minion 2
Minion 4
©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
©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
©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
©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
©2016 Couchbase Inc.
DC/OS
5
©2016 Couchbase Inc.
DC/OS
5
Master
Slave 1
Slave 3
Slave 2
©2016 Couchbase Inc.
DC/OS
5
Master
Slave 1
Slave 3
Slave 2
©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" } }
©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
©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
©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