Kompose
From docker-compose
to
Kubernetes
Thomas HAREAU
september/october 2017
The final report can be found here
Docker
- Docker Compose
- Docker Swarm
Kubernetes
=> kubernetes manifest
=> docker-compose.yml
Example: Sentry
sentry-worker
sentry
postgres
postgres
sentry-cron
sentry
sentry-web
sentry
redis
Redis
Text
sentry-worker
sentry
postgres
postgres
sentry-cron
sentry
sentry-web
sentry
redis
Redis
scone-cli
- Install volumes
- deploy database
- update sentry
- deploy sentry
And with Kubernetes?
Kompose
- kompose up
- kompose convert
experience
- microservices demo (sock shop)
- example voting app
- scone cli (sentry)
Achievement of Kompose
version: "3"
services:
redis-master:
image: gcr.io/google_containers/redis:e2e
ports:
- "6379"
redis-slave:
image: gcr.io/google_samples/gb-redisslave:v1
ports:
- "6379"
environment:
- GET_HOSTS_FROM=dns
frontend:
image: gcr.io/google-samples/gb-frontend:v4
ports:
- "80:80"
environment:
- GET_HOSTS_FROM=dns
labels:
kompose.service.type: LoadBalancer
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
annotations:
kompose.cmd: kompose convert -o result
kompose.service.type: LoadBalancer
kompose.version: 1.2.0 (99f88ef)
creationTimestamp: null
labels:
io.kompose.service: frontend
name: frontend
spec:
replicas: 1
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
io.kompose.service: frontend
spec:
containers:
- env:
- name: GET_HOSTS_FROM
value: dns
image: gcr.io/google-samples/gb-frontend:v4
name: frontend
ports:
- containerPort: 80
resources: {}
restartPolicy: Always
status: {}
apiVersion: v1
kind: Service
metadata:
annotations:
kompose.cmd: kompose convert -o result
kompose.service.type: LoadBalancer
kompose.version: 1.2.0 (99f88ef)
creationTimestamp: null
labels:
io.kompose.service: frontend
name: frontend
spec:
ports:
- name: "80"
port: 80
targetPort: 80
selector:
io.kompose.service: frontend
type: LoadBalancer
status:
loadBalancer: {}
frontend
Limitation of Kompose
- tmpfs
- build management
- volume management
tmpfs
queue-master:
image: weaveworksdemos/queue-master
hostname: queue-master
volumes:
- /var/run/docker.sock:/...
restart: always
cap_drop:
- all
cap_add:
- NET_BIND_SERVICE
read_only: true
tmpfs:
- /tmp:rw,noexec,nosuid
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: queue-master
spec:
template:
spec:
containers:
- image: weaveworksdemos/queue-master
name: queue-master
# ...
volumeMounts:
- mountPath: /tmp:rw,noexec,nosuid
name: queue-master-tmpfs0
restartPolicy: Always
volumes:
- emptyDir:
medium: Memory
name: queue-master-tmpfs0
status: {}
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: queue-master
spec:
template:
spec:
containers:
- image: weaveworksdemos/queue-master
name: queue-master
# ...
volumeMounts:
- mountPath: /tmp
name: queue-master-tmpfs0
restartPolicy: Always
volumes:
- emptyDir:
medium: Memory
name: queue-master-tmpfs0
status: {}
build
vote:
build: ./vote
command: python app.py
volumes:
- ./vote:/app
ports:
- "5000:80"
networks:
- front-tier
- back-tier
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
creationTimestamp: null
labels:
io.kompose.service: vote
name: vote
spec:
# ...
template:
metadata:
creationTimestamp: null
labels:
io.kompose.service: vote
spec:
containers:
- args:
- python
- app.py
image: vote
name: vote
# ...
status: {}
Not yet supported
- push image to a registry
- synchronize the volume in every node
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
creationTimestamp: null
labels:
io.kompose.service: vote
name: vote
spec:
# ...
template:
metadata:
creationTimestamp: null
labels:
io.kompose.service: vote
spec:
containers:
- args:
- python
- app.py
image: yourregistry.de/vote
name: vote
# ...
status: {}
volume management
Volume
PVC
PV
emptyDir
hostPath
nfs
gcePersistentDisk
...
volume in Kubernetes
PV
- size
- storageClass
emptyDir
hostPath
nfs
gcePersistentDisk
PVC
- size
- storageClass
emptyDir
...
volume management
- No One to One conversion
- emptyDir
- PVC creation
- but no StorageClass...
- need to be edited
Conclusion
- tmpfs => bug, will be fixed
- build => difficult, but avoidable
- volume => difficult, but scriptable
- ...
Evaluation
- example voting app
- microservices demo
example voting app
latency when sending get requests (vote)
microservices demo
latency when sending post requests (/orders)
Conclusion
- Kompose is usable, but not alone
- No efficiency issue
The final report can be found here
Kompose
By Thomas Hareau
Kompose
- 2,324