kompose Basic
Kompose Basic
简介
A conversion tool to go from Docker Compose to Kubernetes
What’s Kompose?
Kompose is a conversion tool for Docker Compose to container orchestrators such as Kubernetes (or OpenShift).
Kompose is deployed as a binary onto a client. To install Kompose on Katacoda, run the command as blow:
Details on how to install Kompose for your OS can be found at https://github.com/kubernetes/kompose/releases
简单样例
docker-compose.yaml
文件内容如下所示:
As with Docker Compose, Kompose allows the Images to be deployed using a single command of kompose up
The details of what has been deployed can be discovered with the Kubernetes CLI kubectl.
Kompose also has the ability to take existing Compose files and generate the related Kubernetes Manifest files.
The command kompose convert
will generate the files, viewable via ls
.
Use command kompose convert -j
will generate the json format files.
Use command kompose --provider openshift convert
will generate the OpenShift
format files.
转载:Deploy Docker Compose with Kompose — Katacoda
Minikube and Kompose
In this guide, we’ll deploy a sample docker-compose.yaml
file to a Kubernetes cluster.
Requirements:
Start minikube
:
If you don’t already have a Kubernetes cluster running, minikube is the best way to get started.
Download an example Docker Compose file, or use your own:
Convert your Docker Compose file to Kubernetes:
Run kompose convert
in the same directory as your docker-compose.yaml
file.
Alternatively, you can convert and deploy directly to Kubernetes with kompose up
.
Access the newly deployed service:
Now that your service has been deployed, let’s access it.
If you’re using minikube
you may access it via the minikube service
command.
Otherwise, use kubectl
to see what IP the service is using:
Note: If you’re using a cloud provider, your IP will be listed next to LoadBalancer Ingress
.
If you have yet to expose your service (for example, within GCE), use the command:
To check functionality, you may also curl
the URL.
参考链接
- kompose user-guide: https://kompose.io/user-guide/