guilhermecgs guilhermecgs -3 years ago 346
YAML Question

Docker stack to Kubernetes

I am quite familiar with Docker, but I have zero experience on Kubernetes.

I have a Docker stack (multi-container) software that I can deploy in a Docker swarm cluster. I was wondering if Kubernetes has something similar? I don't need replicas, auto scaling and so on... I just need a group of containers working together with its dependencies and networks defined in single text file.

I have searched and found a tool called kompose that translates the Docker stack file to Kubernetes syntax... However, it looks like the output is a list of

*.yaml
files, instead of a single file.

So, I came to the conclusion that kubernetes does not have this exact functionality.. Am I missing something?

Answer Source

You can copy the content of the generated files into one file and separate them with ---.

For instance, if you've got 3 Kubernetes files: service.yml, deployment.yml and configmap.yml, your file should look something like:

# content of service.yml
....
---
# content of deployment.yml
....
---
# content of configmap.yml
....

You would use the same kubectl commands to CRUD using this spec file.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download