You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/tools/kompose/user-guide.md
+97-96Lines changed: 97 additions & 96 deletions
Original file line number
Diff line number
Diff line change
@@ -14,45 +14,50 @@ redirect_from:
14
14
15
15
`kompose` is a tool to help users who are familiar with `docker-compose` move to **Kubernetes**. `kompose` takes a Docker Compose file and translates it into Kubernetes resources.
16
16
17
+
More information about Kompose can be found on the official [http://kompose.io](http://kompose.io/) site.
18
+
17
19
`kompose` is a convenience tool to go from local Docker development to managing your application with Kubernetes. Transformation of the Docker Compose format to Kubernetes resources manifest may not be exact, but it helps tremendously when first deploying an application on Kubernetes.
18
20
19
21
## Use Case
20
22
21
23
If you have a Docker Compose `docker-compose.yml` or a Docker Distributed Application Bundle `docker-compose-bundle.dab` file, you can convert it into Kubernetes deployments and services like this:
Grab the latest [release](https://github.com/kubernetes-incubator/kompose/releases) for your OS, untar and extract the binary.
36
+
We have multiple ways to install Kompose. Our prefered method is downloading the binary from the latest GitHub release.
42
37
43
-
### Linux
38
+
### GitHub release
39
+
40
+
Kompose is released via GitHub on a three-week cycle, you can see all current releases on the [GitHub release page](https://github.com/kubernetes-incubator/kompose/releases).
Kompose has support for two providers: OpenShift and Kubernetes.
52
-
You can choose targeted provider either using global option `--provider`, or by setting environment variable `PROVIDER`.
53
-
By setting environment variable `PROVIDER` you can permanently switch to OpenShift provider without need to always specify `--provider openshift` option.
54
-
If no provider is specified Kubernetes is default provider.
55
+
Make the binary executable and move it to your PATH (e.g. `/usr/local/bin`)
INFO[0000] file "web-deploymentconfig.yaml" created
169
-
INFO[0000] file "web-imagestream.yaml" created
170
-
INFO[0000] file "redis-deploymentconfig.yaml" created
171
-
INFO[0000] file "redis-imagestream.yaml" created
170
+
WARN: Unsupported key networks - ignoring
171
+
INFO file "redis-svc.yaml" created
172
+
INFO file "web-svc.yaml" created
173
+
INFO file "web-deploymentconfig.yaml" created
174
+
INFO file "web-imagestream.yaml" created
175
+
INFO file "redis-deploymentconfig.yaml" created
176
+
INFO file "redis-imagestream.yaml" created
172
177
```
173
178
174
179
It also supports creating buildconfig for build directive in a service. By default, it uses the remote repo for the current git branch as the source repo, and the current branch as the source branch for the build. You can specify a different source repo and branch using ``--build-repo`` and ``--build-branch`` options respectively.
WARN [foo] Service cannot be created because of missing port.
184
+
INFO Buildconfig using [email protected]:rtnpro/kompose.git::master as source.
185
+
INFO file "foo-deploymentconfig.yaml" created
186
+
INFO file "foo-imagestream.yaml" created
187
+
INFO file "foo-buildconfig.yaml" created
183
188
```
184
189
185
190
**Note**: If you are manually pushing the Openshift artifacts using ``oc create -f``, you need to ensure that you push the imagestream artifact before the buildconfig artifact, to workaround this Openshift issue: https://github.com/openshift/origin/issues/4518 .
@@ -195,12 +200,12 @@ $ kompose --file ./examples/docker-guestbook.yml up
195
200
We are going to create Kubernetes deployments and services for your Dockerized application.
196
201
If you need different kind of resources, use the 'kompose convert' and 'kubectl create -f' commands instead.
197
202
198
-
INFO[0000] Successfully created service: redis-master
199
-
INFO[0000] Successfully created service: redis-slave
200
-
INFO[0000] Successfully created service: frontend
201
-
INFO[0001] Successfully created deployment: redis-master
202
-
INFO[0001] Successfully created deployment: redis-slave
203
-
INFO[0001] Successfully created deployment: frontend
203
+
INFO Successfully created service: redis-master
204
+
INFO Successfully created service: redis-slave
205
+
INFO Successfully created service: frontend
206
+
INFO Successfully created deployment: redis-master
207
+
INFO Successfully created deployment: redis-slave
208
+
INFO Successfully created deployment: frontend
204
209
205
210
Your application has been deployed to Kubernetes. You can run 'kubectl get deployment,svc,pods' for details.
- You must have a running Kubernetes cluster with a pre-configured kubectl context.
227
231
- Only deployments and services are generated and deployed to Kubernetes. If you need different kind of resources, use the 'kompose convert' and 'kubectl create -f' commands instead.
228
232
@@ -232,15 +236,15 @@ $kompose --file ./examples/docker-guestbook.yml --provider openshift up
232
236
We are going to create OpenShift DeploymentConfigs and Services for your Dockerized application.
233
237
If you need different kind of resources, use the 'kompose convert' and 'oc create -f' commands instead.
234
238
235
-
INFO[0000] Successfully created service: redis-slave
236
-
INFO[0000] Successfully created service: frontend
237
-
INFO[0000] Successfully created service: redis-master
238
-
INFO[0000] Successfully created deployment: redis-slave
239
-
INFO[0000] Successfully created ImageStream: redis-slave
240
-
INFO[0000] Successfully created deployment: frontend
241
-
INFO[0000] Successfully created ImageStream: frontend
242
-
INFO[0000] Successfully created deployment: redis-master
243
-
INFO[0000] Successfully created ImageStream: redis-master
239
+
INFO Successfully created service: redis-slave
240
+
INFO Successfully created service: frontend
241
+
INFO Successfully created service: redis-master
242
+
INFO Successfully created deployment: redis-slave
243
+
INFO Successfully created ImageStream: redis-slave
244
+
INFO Successfully created deployment: frontend
245
+
INFO Successfully created ImageStream: frontend
246
+
INFO Successfully created deployment: redis-master
247
+
INFO Successfully created ImageStream: redis-master
244
248
245
249
Your application has been deployed to OpenShift. You can run 'oc get dc,svc,is' for details.
INFO Successfully deleted deployment: redis-master
277
+
INFO Successfully deleted service: redis-slave
278
+
INFO Successfully deleted deployment: redis-slave
279
+
INFO Successfully deleted service: frontend
280
+
INFO Successfully deleted deployment: frontend
278
281
```
279
282
Note:
280
283
- You must have a running Kubernetes cluster with a pre-configured kubectl context.
@@ -284,16 +287,16 @@ Note:
284
287
The default `kompose` transformation will generate Kubernetes [Deployments](http://kubernetes.io/docs/user-guide/deployments/) and [Services](http://kubernetes.io/docs/user-guide/services/), in yaml format. You have alternative option to generate json with `-j`. Also, you can alternatively generate [Replication Controllers](http://kubernetes.io/docs/user-guide/replication-controller/) objects, [Deamon Sets](http://kubernetes.io/docs/admin/daemons/), or [Helm](https://github.com/helm/helm) charts.
285
288
286
289
```console
287
-
$ kompose convert
288
-
file "redis-svc.yaml" created
289
-
file "web-svc.yaml" created
290
-
file "redis-deployment.yaml" created
291
-
file "web-deployment.yaml" created
290
+
$ kompose convert -j
291
+
file "redis-svc.json" created
292
+
file "web-svc.json" created
293
+
file "redis-deployment.json" created
294
+
file "web-deployment.json" created
292
295
```
293
296
The `*-deployment.json` files contain the Deployment objects.
294
297
295
298
```console
296
-
$ kompose convert --rc
299
+
$ kompose convert --rc
297
300
file "redis-svc.yaml" created
298
301
file "web-svc.yaml" created
299
302
file "redis-rc.yaml" created
@@ -303,7 +306,7 @@ file "web-rc.yaml" created
303
306
The `*-rc.yaml` files contain the Replication Controller objects. If you want to specify replicas (default is 1), use `--replicas` flag: `$ kompose convert --rc --replicas 3`
304
307
305
308
```console
306
-
$ kompose convert --ds
309
+
$ kompose convert --ds
307
310
file "redis-svc.yaml" created
308
311
file "web-svc.yaml" created
309
312
file "redis-daemonset.yaml" created
@@ -315,7 +318,7 @@ The `*-daemonset.yaml` files contain the Daemon Set objects
315
318
If you want to generate a Chart to be used with [Helm](https://github.com/kubernetes/helm) simply do:
316
319
317
320
```console
318
-
$ kompose convert -c
321
+
$ kompose convert -c
319
322
file "web-svc.yaml" created
320
323
file "redis-svc.yaml" created
321
324
file "web-deployment.yaml" created
@@ -337,11 +340,7 @@ The chart structure is aimed at providing a skeleton for building your Helm char
If the Docker Compose file has a volume specified for a service, the Deployment (Kubernetes) or DeploymentConfig (OpenShift) strategy is changed to "Recreate" instead of "RollingUpdate" (default). This is done to avoid multiple instances of a service from accessing a volume at the same time.
0 commit comments