# Technical Documentation: kubernetes/kompose

> ℹ️ **Provenance:** Multi-Tier Ingestion · [CodeWiki Reference](https://codewiki.google/github.com/kubernetes/kompose)

### Overview (`README.md`)

# Kompose (Kubernetes + Compose)

[![Build Status Widget]][Build Status] [![Coverage Status Widget]][Coverage Status] [![GoDoc Widget]][GoDoc]  [![GoReportCard Widget]][GoReportCardResult]



`kompose` is a tool to help users who are familiar with `docker-compose` move to [Kubernetes](http://kubernetes.io). `kompose` takes a [Compose Specification](https://compose-spec.io/) file and translates it into Kubernetes resources.

`kompose` is a convenience tool to go from local Compose environment to managing your application with Kubernetes. Transformation of the [Compose Specification](https://compose-spec.io/) format to Kubernetes resources manifest may not be exact, but it helps tremendously when first deploying an application on Kubernetes.

## Use Case

Convert [`compose.yaml`](https://raw.githubusercontent.com/kubernetes/kompose/main/examples/compose.yaml) into Kubernetes deployments and services with one simple command:

```sh
$ kompose convert -f compose.yaml
INFO Kubernetes file "frontend-service.yaml" created
INFO Kubernetes file "redis-leader-service.yaml" created
INFO Kubernetes file "redis-replica-service.yaml" created
INFO Kubernetes file "frontend-deployment.yaml" created
INFO Kubernetes file "redis-leader-deployment.yaml" created
INFO Kubernetes file "redis-replica-deployment.yaml" created
```

Other examples are provided in the _examples_ [directory](./examples).

## Installation

We have multiple ways to install Kompose. Our preferred method is downloading the binary from the latest GitHub release.

Our entire list of installation methods are located in our [installation.md](/docs/installation.md) document.

Installation methods:

- [Binary (Preferred method)](/docs/installation.md#github-release)
- [Go](/docs/installation.md#go)
- [CentOS](/docs/installation.md#centos)
- [openSUSE/SLE](/docs/installation.md#opensusesle)
- [NixOS](/docs/installation.md#nixos)
- [macOS (Homebrew and MacPorts)](/docs/installation.md#macos)
- [Windows](/docs/installation.md#windows)
- [Docker](/docs/installation.md#docker)

#### Binary installation

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/kompose/releases).

**Linux and macOS:**

```sh
# Linux
curl -L https://github.com/kubernetes/kompose/releases/download/v1.38.0/kompose-linux-amd64 -o kompose

# macOS
curl -L https://github.com/kubernetes/kompose/releases/download/v1.38.0/kompose-darwin-amd64 -o kompose

chmod +x kompose
sudo mv ./kompose /usr/local/bin/kompose
```

**Windows:**

Download from [GitHub](https://github.com/kubernetes/kompose/releases/download/v1.38.0/kompose-windows-amd64.exe) and add the binary to your PATH.

## Shell autocompletion

We support Bash, Zsh and Fish autocompletion.

```sh
# Bash (add to .bashrc for persistence)
source <(kompose completion bash)

# Zsh (add to .zshrc for persistence)
source <(kompose completion zsh)

# Fish autocompletion
kompose completion fish | source
```

## Development and building of Kompose

### Building with `go`

**Requisites:**

1. [make](https://www.gnu.org/software/make/)
2. [Golang](https://golang.org/) v1.6 or later
3. Set `GOPATH` correctly or click [SettingGOPATH](https://github.com/golang/go/wiki/SettingGOPATH) for details

**Steps:**

1. Clone repository

```console
$ git clone https://github.com/kubernetes/kompose.git $GOPATH/src/github.com/kubernetes/kompose
```

2. Change directory to the cloned repo.

```console
cd $GOPATH/src/github.com/kubernetes/kompose
```

3. Build with `make`

```console
$ make bin
```

4. Or build with `go`

```console
$ go build -o kompose main.go
```

5. Test your changes

```console
$ make test
```

## Documentation

Documentation can be found at our [kompose.io](http://kompose.io) website or our [docs](https://github.com/kubernetes/kompose/tree/main/docs) folder.

Here is a list of all available docs:

- [Quick start](docs/getting-started.md)
- [Installation](docs/installation.md)
- [User guide](docs/user-guide.md)
- [Conversion](docs/conversion.md)
- [Architecture](docs/architecture.md)
- [Development](docs/development.md)

## Community, Discussion, Contribution, and Support

**Issues:** If you find any issues, please [file it](https://github.com/kubernetes/kompose/issues).

**Kubernetes Community:** As part of the Kubernetes ecosystem, we follow the Kubernetes community principles. More information can be found on the [community page](http://kubernetes.io/community/).

**Chat (Slack):** We're fairly active on [Slack](http://slack.kubernetes.io#kompose) and you can find us in the #kompose channel.

### Code of Conduct

Participation in the Kubernetes community is governed by the [Kubernetes Code of Conduct](code-of-conduct.md).

[Build Status]: https://github.com/kubernetes/kompose/actions?query=workflow%3A%22Kompose+CI%22
[Build Status Widget]: https://github.com/kubernetes/kompose/workflows/Kompose%20CI/badge.svg
[GoDoc]: https://godoc.org/github.com/kubernetes/kompose
[GoDoc Widget]: https://godoc.org/github.com/kubernetes/kompose?status.svg
[Coverage Status Widget]: https://coveralls.io/repos/github/kubernetes/kompose/badge.svg?branch=main
[Coverage Status]: https://coveralls.io/github/kubernetes/kompose?branch=main
[GoReportCard Widget]: https://goreportcard.com/badge/github.com/kubernetes/kompose
[GoReportCardResult]: https://goreportcard.com/report/github.com/kubernetes/kompose

---

### Overview (`build/README.md`)

# Fedora RPM packaging

There are instructions on how to build the RPM.

# 1. Gofed

Grab gofed from https://github.com/gofed/gofed

Choose which version of the repo you want to build. For kompose it was 0.3.0 and the commit was 135165b39c55d29a5426479ded81eddd56bfbaf4

Run the following to generate spec file:

```sh
gofed repo2spec --detect github.com/kubernetes/kompose --commit 135165b39c55d29a5426479ded81eddd56bfbaf4 --with-extra --with-build -f
```

The spec file is now located at:

```sh
$HOME/gofed/golang-github-kubernetes-incubator-kompose/golang-github-kubernetes-incubator-kompose.spec
```

# 2. Dependencies

Now we need to go through and fix some things.

Generate bundled dependencies by using parsedeps.go

Go to the kompose source folder and then run:

```sh
go run parsedeps.go
```

In the future this will possibly done by `gofed`, see: https://github.com/gofed/gofed/issues/42

# 3. Building a source RPM locally on CentOS

First, follow instructions to do local setup https://wiki.centos.org/HowTos/SetupRpmBuildEnvironment

Source: https://wiki.centos.org/HowTos/RebuildSRPM

Second, checkout the source to the release commit

Copy the kompose code directory with name `kompose-135165b39c55d29a5426479ded81eddd56bfbaf4`

Tar the `kompose-135165b39c55d29a5426479ded81eddd56bfbaf4` code directory as `kompose-135165b.tar.gz` and copy it to `$HOME/rpmbuild/SOURCES/`

Run following command:

```sh
rpmbuild -ba kompose.spec
```

Find the srpm in `$HOME/rpmbuild/SRPMS`

Find the RPM in `$HOME/rpmbuild/RPM/arch/`

Check that the dependencies are proper:

```sh
rpm -qpR RPMS/x86_64/kompose-0.3.0-0.1.git135165b.el7.centos.x86_64.rpm
```

# 4. Running in on Koji (build system)

First, setup your environment in order to run Koji: https://fedoraproject.org/wiki/Using_the_Koji_build_system

Example setup:

```sh
fedora-packager-setup
kinit <username>@FEDORAPROJECT.ORG
```

To build it on koji run:

```
koji build --scratch rawhide kompose-0.3.0-0.1.git135165b.el7.centos.src.rpm
```

---

### Overview (`docs/README.md`)

View the site via:

```sh
bundle exec jekyll serve .
```

And visiting `localhost:4000` on your browser.

---

### Overview (`.openvex/templates/README.md`)

# OpenVEX Templates Directory

This directory contains the OpenVEX data for this repository.
The files stored in this directory are used as templates by
`vexctl generate` when generating VEX data for a release or 
a specific artifact.

To add new statements to publish data about a vulnerability,
download [vexctl](https://github.com/openvex/vexctl)
and append new statements using `vexctl add`. For example:
```
vexctl add --in-place main.openvex.json pkg:oci/test CVE-2014-1234567 fixed
```
That will add a new VEX statement expressing that the impact of
CVE-2014-1234567 is under investigation in the test image. When
cutting a new release, for `pkg:oci/test` the new file will be
incorporated to the relase's VEX data.

## Read more about OpenVEX

To know more about generating, publishing and using VEX data
in your project, please check out the vexctl repository and
documentation: https://github.com/openvex/vexctl

OpenVEX also has an examples repository with samples and docs:
https://github.com/openvex/examples

---

### Overview (`examples/web/README.md`)

A fork of https://github.com/kubernetes/examples/blob/master/guestbook-go/README.md

A simple example that shows the functionality of Kompose

Pushed to https://docker.io/kompose/web

---

### Overview (`script/test/README.md`)

# Functional Test

### Requirements

Install `jq - commandline JSON processor` with minimum version of 1.5


### Running tests

Test running ./cmd/tests.sh

---

### Getting Started (`docs/getting-started.md`)

---
layout: default
permalink: /getting-started/
title: Getting Started
redirect_from:
  - /docs/getting-started.md/
  - /docs/getting-started/
---

# Getting Started

* TOC
{:toc}

This is how you'll get started with Kompose!

There are three different guides depending on your container orchestrator as well as operating system.

For beginners and the most compatibility, follow the _Minikube and Kompose_ guide.

## Minikube and Kompose

In this guide, we'll deploy a sample `compose.yaml` file to a Kubernetes cluster.

Requirements:

- [minikube](https://github.com/kubernetes/minikube)
- [kompose](https://github.com/kubernetes/kompose)

**Start `minikube`:**

If you don't already have a Kubernetes cluster running, [minikube](https://github.com/kubernetes/minikube) is the best way to get started.

```sh
$ minikube start
Starting local Kubernetes v1.7.5 cluster...
Starting VM...
Getting VM IP address...
Moving files into cluster...
Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
Starting cluster components...
Kubectl is now configured to use the cluster
```

**Download an [example Compose file](https://raw.githubusercontent.com/kubernetes/kompose/main/examples/compose.yaml), or use your own:**

```sh
wget https://raw.githubusercontent.com/kubernetes/kompose/main/examples/compose.yaml
```

**Convert your Compose file to Kubernetes:**

Run `kompose convert` in the same directory as your `compose.yaml` file.

```sh
$ kompose convert
INFO Kubernetes file "frontend-service.yaml" created
INFO Kubernetes file "redis-leader-service.yaml" created
INFO Kubernetes file "redis-replica-service.yaml" created
INFO Kubernetes file "frontend-deployment.yaml" created
INFO Kubernetes file "redis-leader-deployment.yaml" created
INFO Kubernetes file "redis-replica-deployment.yaml" created
```

Then you can use `kubectl apply` to create these resources in Kubernetes.

**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.

```sh
$ minikube service frontend
```

Otherwise, use `kubectl` to see what IP the service is using:

```sh
$ kubectl describe svc frontend
Name:                   frontend
Namespace:              default
Labels:                 service=frontend
Selector:               service=frontend
Type:                   LoadBalancer
IP:                     10.0.0.183
LoadBalancer Ingress:   123.45.67.89
Port:                   80      80/TCP
NodePort:               80      31144/TCP
Endpoints:              172.17.0.4:80
Session Affinity:       None
No events.
```

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:

```sh
kubectl expose deployment frontend --type="LoadBalancer"
```

To check functionality, you may also `curl` the URL.

```sh
$ curl http://123.45.67.89
```

## Minishift and Kompose

In this guide, we'll deploy a sample `compose.yaml` file to an OpenShift cluster.

Requirements:

- [minishift](https://github.com/minishift/minishift)
- [kompose](https://github.com/kubernetes/kompose)
- An OpenShift route created

**Note:** The service will NOT be accessible until you create an OpenShift route with `oc expose`. You must also have a virtualization environment setup. By default, `minishift` uses KVM.

**Start `minishift`:**

[Minishift](https://github.com/minishift/minishift) is a tool that helps run OpenShift locally using a single-node cluster inside a VM. Similar to [minikube](https://github.com/kubernetes/minikube).

```sh
$ minishift start
Starting local OpenShift cluster using 'kvm' hypervisor...
-- Checking OpenShift client ... OK
-- Checking Docker client ... OK
-- Checking Docker version ... OK
-- Checking for existing OpenShift container ... OK
...
```

**Download an [example Compose file](https://raw.githubusercontent.com/kubernetes/kompose/main/examples/compose.yaml), or use your own:**

```sh
wget https://raw.githubusercontent.com/kubernetes/kompose/main/examples/compose.yaml
```

**Convert your Compose file to OpenShift:**

Run `kompose convert --provider=openshift` in the same directory as your `compose.yaml` file.

```sh
$ kompose convert --provider=openshift
INFO OpenShift file "frontend-service.yaml" created
INFO OpenShift file "redis-leader-service.yaml" created
INFO OpenShift file "redis-replica-service.yaml" created
INFO OpenShift file "frontend-deploymentconfig.yaml" created
INFO OpenShift file "frontend-imagestream.yaml" created
INFO OpenShift file "redis-leader-deploymentconfig.yaml" created
INFO OpenShift file "redis-leader-imagestream.yaml" created
INFO OpenShift file "redis-replica-deploymentconfig.yaml" created
INFO OpenShift file "redis-replica-imagestream.yaml" created
```

Then you can use `kubectl apply` to create these resources in OpenShift cluster.

**Access the newly deployed service:**

After deployment, you must create an OpenShift route in order to access the service.

If you're using `minishift`, you'll use a combination of `oc` and `minishift` commands to access the service.

Create a route for the `frontend` service using `oc`:

```sh
$ oc expose service/frontend
route "frontend" exposed
```

Access the `frontend` service with `minishift`:

```sh
$ minishift openshift service frontend --namespace=myproject
Opening the service myproject/frontend in the default browser...
```

You can also access the GUI interface of OpenShift for an overview of the deployed containers:

```sh
$ minishift console
Opening the OpenShift Web console in the default browser...
```

## RHEL and Kompose

In this guide, we'll deploy a sample `compose.yaml` file using both RHEL (Red Hat Enterprise Linux) and OpenShift.

Requirements:

- Red Hat Enterprise Linux 7.4
- [Red Hat Development Suite](https://developers.redhat.com/products/devsuite/overview/)
  - Which includes:
  - [minishift](https://github.com/minishift/minishift)
  - [kompose](https://github.com/kubernetes/kompose)

**Note:** A KVM hypervisor must be setup in order to correctly use `minishift` on RHEL. You can set it up via the [CDK Documentation](https://access.redhat.com/documentation/en-us/red_hat_container_development_kit/3.1/html-single/getting_started_guide/index#setup-virtualization) under "Set up your virtualization environment".

**Install Red Hat Development Suite:**

Before we are able to use both `minishift` and `kompose`, DevSuite must be installed. A more concise [installation document is available](https://developers.redhat.com/products/cdk/hello-world#fndtn-rhel).

Change to root.

```sh
$ su -
```

Enable the Red Hat Developer Tools software repository.

```sh
$ subscription-manager repos --enable rhel-7-server-devtools-rpms
$ subscription-manager repos --enable rhel-server-rhscl-7-rpms
```

Add the Red Hat Developer Tools key to your system.

```sh
$ cd /etc/pki/rpm-gpg
$ wget -O RPM-GPG-KEY-redhat-devel https://www.redhat.com/security/data/a5787476.txt
$ rpm --import RPM-GPG-KEY-redhat-devel
```

Install Red Hat Development Suite and Kompose.

```sh
$ yum install rh-devsuite kompose -y
```

**Start `minishift`:**

Before we begin, we must do a few preliminary steps setting up `minishift`.

```sh
$ su -
$ ln -s /var/lib/cdk-minishift-3.0.0/minishift /usr/bin/minishift
$ minishift setup-cdk --force --default-vm-driver="kvm"
$ ln -s /home/$(whoami)/.minishift/cache/oc/v3.5.5.8/oc /usr/bin/oc
```

Now we may start `minishift`.

```sh
$ minishift start
Starting local OpenShift cluster using 'kvm' hypervisor...
-- Checking OpenShift client ... OK
-- Checking Docker client ... OK
-- Checking Docker version ... OK
-- Checking for existing OpenShift container ... OK
...
```

**Download an [example Compose file](https://raw.githubusercontent.com/kubernetes/kompose/main/examples/compose.yaml), or use your own:**

```sh
wget https://raw.githubusercontent.com/kubernetes/kompose/main/examples/compose.yaml
```

**Convert your Compose file to OpenShift:**

Run `kompose convert --provider=openshift` in the same directory as your `compose.yaml` file.

```sh
$ kompose convert --provider=openshift
INFO OpenShift file "frontend-service.yaml" created
INFO OpenShift file "redis-leader-service.yaml" created
INFO OpenShift file "redis-replica-service.yaml" created
INFO OpenShift file "frontend-deploymentconfig.yaml" created
INFO OpenShift file "frontend-imagestream.yaml" created
INFO OpenShift file "redis-leader-deploymentconfig.yaml" created
INFO OpenShift file "redis-leader-imagestream.yaml" created
INFO OpenShift file "redis-replica-deploymentconfig.yaml" created
INFO OpenShift file "redis-replica-imagestream.yaml" created
```

Then you can use `kubectl apply` to create these resources in OpenShift.

**Access the newly deployed service:**

After deployment, you must create an OpenShift route in order to access the service.

If you're using `minishift`, you'll use a combination of `oc` and `minishift` commands to access the service.

Create a route for the `frontend` service using `oc`:

```sh
$ oc expose service/frontend
route "frontend" exposed
```

Access the `frontend` service with `minishift`:

```sh
$ minishift openshift service frontend --namespace=myproject
Opening the service myproject/frontend in the default browser...
```

You can also access the GUI interface of OpenShift for an overview of the deployed containers:

```sh
$ minishift console
Opening the OpenShift Web console in the default browser...
```

---

### Index (`docs/index.md`)

---
# Feel free to add content and custom Front Matter to this file.
# To modify the layout, see https://jekyllrb.com/docs/themes/#overriding-theme-defaults

layout: index
---

```sh
$ kompose convert -f compose.yaml

$ kubectl apply -f .

$ kubectl get po
NAME                            READY     STATUS              RESTARTS   AGE
frontend-591253677-5t038        1/1       Running             0          10s
redis-leader-2410703502-9hshf   1/1       Running             0          10s
redis-replica-4049176185-hr1lr  1/1       Running             0          10s
```

---

###  Config.Yml (`docs/_config.yml`)

title: Kompose
name: Kompose
email: foo@gmail.com
github_page: https://github.com/kubernetes/kompose
slack_page: https://slack.k8s.io
description: >- # this means to ignore newlines until "baseurl:"
  Convert your Docker Compose file to Kubernetes or OpenShift
baseurl: "" # the subpath of your site, e.g. /blog
url: "" # the base hostname & protocol for your site, e.g. http://example.com
year: 2024

# Google Analytics number (starts with UA?)
analytics: 12345

instagram: https://www.instagram.com
facebook: https://www.facebook.com

# Build settings
theme: minima
plugins:
  - jekyll-feed

---

### Architecture (`docs/architecture.md`)

---
layout: default
permalink: /architecture/
title: Architecture
redirect_from:
  - /docs/architecture.md/
  - /docs/architecture/
---

# Architecture and Internal Design

* TOC
{:toc}

`kompose` has 3 stages: _Loader_, _Transformer_ and _Outputter_. Each stage should have a well-defined interface, so it is easy to write a new Loader, Transformer, or Outputters and plug it in. Currently, only Loader and Transformer interfaces are defined.



## Loader

The Loader reads the input file now `kompose` supports [Compose](https://docs.docker.com/compose) v1, v2 and converts it to KomposeObject.

Loader is represented by a Loader interface:

```go
type Loader interface {
      LoadFile(file string) kobject.KomposeObject
}
```

Every loader “implementation” should be placed into `kompose/pkg/loader` (like compose). More input formats will be supported in the future. You can take a look for more details at:

- [kompose/pkg/loader](https://github.com/kubernetes/kompose/tree/master/pkg/loader)
- [kompose/pkg/loader/compose](https://github.com/kubernetes/kompose/tree/master/pkg/loader/compose)

## KomposeObject

`KomposeObject` is Kompose internal representation of all containers loaded from input file. First version of `KomposeObject` looks like this (source: [kobject.go](https://github.com/kubernetes/kompose/blob/master/pkg/kobject/kobject.go)):

```go
// KomposeObject holds the generic struct of Kompose transformation
type KomposeObject struct {
    ServiceConfigs map[string]ServiceConfig
}

// ServiceConfig holds the basic struct of a container
type ServiceConfig struct {
    ContainerName string
    Image         string
    Environment   []EnvVar
    Port          []Ports
    Command       []string
    WorkingDir    string
    Args          []string
    Volumes       []string
    Network       []string
    Labels        map[string]string
    Annotations   map[string]string
    CPUSet        string
    CPUShares     int64
    CPUQuota      int64
    CapAdd        []string
    CapDrop       []string
    Entrypoint    []string
    Expose        []string
    Privileged    bool
    Restart       string
    User          string
}
```

## Transformer

The Transformer takes KomposeObject and converts it to target/output format (currently, there are sets of Kubernetes/OpenShift objects). Similar to the `Loader`, Transformer is represented by a Transformer interface:

```go
type Transformer interface {
     Transform(kobject.KomposeObject, kobject.ConvertOptions) []runtime.Object
}
```

If you wish to add more providers containing different kinds of objects, the Transformer would be the place to look into. Currently, Kompose supports Kubernetes (by default) and OpenShift providers. More details at:

- [kompose/pkg/transformer](https://github.com/kubernetes/kompose/tree/master/pkg/transformer)
- [kompose/pkg/transformer/Kubernetes](https://github.com/kubernetes/kompose/tree/master/pkg/transformer/kubernetes)
- [kompose/pkg/transformer/openshift](https://github.com/kubernetes/kompose/tree/master/pkg/transformer/openshift)

## Outputter

The Outputter takes the Transformer result and executes the given action. For example, action can display results to stdout or directly deploy artifacts to Kubernetes/OpenShift.

---

### Conversion (`docs/conversion.md`)

---
layout: default
title: Conversion
permalink: /conversion/
redirect_from: 
  - /docs/conversion.md/
  - /docs/conversion/
---

# Conversion Matrix

* TOC
{:toc}

This document outlines all possible conversion details regarding `compose.yaml` values to Kubernetes / OpenShift artifacts.

## Version Support

Under the hood, we're using [compose-go](https://github.com/compose-spec/compose-go), the reference library for parsing Compose files. We should be able to load all versions of Compose files.
We're doing our best to keep it up to date as soon as possible in our releases to be compatible with the latest features defined in the [Compose specification](https://github.com/compose-spec/compose-spec/blob/master/spec.md). If you absolutely need a feature we don't support yet, please open a PR!

## Conversion Table

**Glossary:**

- **✓:** Converts
- **-:** Not in this Compose Version
- **n:** Not yet implemented
- **x:** Not applicable / no 1-1 conversion

| Keys                   | V1 | V2 | V3 | Kubernetes / OpenShift                                               | Notes                                                                                                                             |
| ---------------------- | -- | -- | -- | -------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| build                  | ✓  | ✓  | ✓  |                                                                      | Builds/Pushes to Docker repository. See [user guide on build and push image](https://kompose.io/user-guide/#build-and-push-image) |
| build: context         | ✓  | ✓  | ✓  |                                                                      |                                                                                                                                   |
| build: dockerfile      | ✓  | ✓  | ✓  |                                                                      |                                                                                                                                   |
| build: args            | n  | n  | n  |                                                                      |                                                                                                                                   |
| build: cache_from      | -  | -  | n  |                                                                      |                                                                                                                                   |
| cap_add                | ✓  | ✓  | ✓  | Container.SecurityContext.Capabilities.Add                           |                                                                                                                                   |
| cap_drop               | ✓  | ✓  | ✓  | Container.SecurityContext.Capabilities.Drop                          |                                                                                                                                   |
| command                | ✓  | ✓  | ✓  | Container.Args                                                       |                                                                                                                                   |
| configs                | n  | n  | ✓  |                                                                      |                                                                                                                                    |
| configs: short-syntax  | n  | n  | ✓  |                                                                      | Only create configMap                                                                                                             |
| configs: long-syntax   | n  | n  | ✓  |                                                                      | If target path is /, ignore this and only create configMap                                                                        |
| cgroup_parent          | x  | x  | x  |                                                                      | Not supported within Kubernetes. See issue https://github.com/kubernetes/kubernetes/issues/11986                                  |
| container_name         | ✓  | ✓  | ✓  | Metadata.Name + Deployment.Spec.Containers.Name                      |                                                                                                                                   |
| credential_spec        | x  | x  | x  |                                                                      | Only applicable to Windows containers                                                                                             |
| deploy                 | -  | -  | ✓  |                                                                      |                                                                                                                                   |
| deploy: mode           | -  | -  | ✓  |                                                                      |                                                                                                                                   |
| deploy: replicas       | -  | -  | ✓  | Deployment.Spec.Replicas / DeploymentConfig.Spec.Replicas            |                                                                                                                                   |
| deploy: placement      | -  | -  | ✓  | Affinity                                                             |                                                                                                                                   |
| deploy: update_config  | -  | -  | ✓  | Workload.Spec.Strategy                                               | Deployment / DeploymentConfig                                                                                                     |
| deploy: resources      | -  | -  | ✓  | Containers.Resources.Limits.Memory / Containers.Resources.Limits.CPU | Support for memory as well as cpu                                                                                                 |
| deploy: restart_policy | -  | -  | ✓  | Pod generation                                                       | This generated a Pod, see the [user guide on restart](http://kompose.io/user-guide/#restart)                                      |
| deploy: labels         | -  | -  | ✓  | Workload.Metadata.Labels                                             | Only applied to workload resource                                                                                                 |
| devices                | x  | x  | x  |                                                                      | Not supported within Kubernetes, See issue https://github.com/kubernetes/kubernetes/issues/5607                                   |
| depends_on             | x  | x  | x  |                                                                      |                                                                                                                                   |
| dns                    | x  | x  | x  |                                                                      | Not used within Kubernetes. Kubernetes uses a managed DNS server                                                                  |
| dns_search             | x  | x  | x  |                                                                      | See `dns` key                                                                                                                     |
| domainname             | ✓  | ✓  | ✓  | SubDomain                                                            |                                                                                                                                   |
| tmpfs                  | ✓  | ✓  | ✓  | Containers.Volumes.EmptyDir                                          | Creates emptyDirvolume with medium set to Memory & mounts given directory inside container                                        |
| entrypoint             | ✓  | ✓  | ✓  | Container.Command                                                    |                                                                                                                                   |
| env_file               | n  | n  | ✓  |                                                                      |                                                                                                                                   |
| environment            | ✓  | ✓  | ✓  | Container.Env                                                        |                                                                                                                                   |
| expose                 | ✓  | ✓  | ✓  | Service.Spec.Ports                                                   |                                                                                                                                   |
| endpoint_mode          | n  | n  | ✓  |                                                                      | If endpoint_mode=vip, the created Service will be forced to set to NodePort type                                                  |
| extends                | ✓  | ✓  | ✓  |                                                                      | Extends by utilizing the same image supplied                                                                                      |
| external_links         | x  | x  | x  |                                                                      | Kubernetes uses a flat-structure for all containers and thus external_links does not have a 1-1 conversion                        |
| extra_hosts            | n  | n  | n  |                                                                      |                                                                                                                                   |
| group_add              | ✓  | ✓  | ✓  |                                                                      |                                                                                                                                   |
| healthcheck            | -  | n  | ✓  |                                                                      |                                                                                                                                   |
| hostname               | ✓  | ✓  | ✓  | HostName                                                             |                                                                                                                                   |
| image                  | ✓  | ✓  | ✓  | Deployment.Spec.Containers.Image                                     |                                                                                                                                   |
| isolation              | x  | x  | x  |                                                                      | Not applicable as this applies to Windows with HyperV support                                                                     |
| labels                 | ✓  | ✓  | ✓  | Metadata.Annotations                                                 |                                                                                                                                   |
| links                  | x  | x  | x  |                                                                      | All containers in the same pod are accessible in Kubernetes                                                                       |
| logging                | x  | x  | x  |                                                                      | Kubernetes has built-in logging support at the node-level                                                                         |
| network_mode           | x  | x  | x  |                                                                      | Kubernetes uses its own cluster networking                                                                                        |
| networks               | ✓  | ✓  | ✓  |                                                                      | See `networks` key                                                                                                                |
| networks: aliases      | x  | x  | x  |                                                                      | See `networks` key                                                                                                                |
| networks: addresses    | x  | x  | x  |                                                                      | See `networks` key                                                                                                                |
| pid                    | ✓  | ✓  | ✓  | HostPID                                                              |                                                                                                                                   |
| ports                  | ✓  | ✓  | ✓  | Service.Spec.Ports                                                   |                                                                                                                                   |
| ports: short-syntax    | ✓  | ✓  | ✓  | Service.Spec.Ports                                                   |                                                                                                                                   |
| ports: long-syntax     | -  | -  | ✓  | Service.Spec.Ports                                                   |                                                                                                                                   |
| secrets                | -  | -  | ✓  | Secret                                                               | External Secret is not Supported                                                                                                  |
| secrets: short-syntax  | -  | -  | ✓  | Secret                                                               | External Secret is not Supported                                                                                                  |
| secrets: long-syntax   | -  | -  | ✓  | Secret                                                               | External Secret is not Supported                                                                                                  |
| security_opt           | x  | x  | x  |                                                                      | Kubernetes uses its own container naming scheme                                                                                   |
| stop_grace_period      | ✓  | ✓  | ✓  | TerminationGracePeriodSeconds                                        |                                                                                                                                   |
| stop_signal            | x  | x  | x  |                                                                      | Not supported within Kubernetes. See issue https://github.com/kubernetes/kubernetes/issues/30051                                  |
| sysctls                | n  | n  | n  |                                                                      |                                                                                                                                   |
| ulimits                | x  | x  | x  |                                                                      | Not supported within Kubernetes. See issue https://github.com/kubernetes/kubernetes/issues/3595                                   |
| userns_mode            | x  | x  | x  |                                                                      | Not supported within Kubernetes and ignored in Compose Version 3                                                           |
| volumes                | ✓  | ✓  | ✓  | PersistentVolumeClaim                                                | Creates a PersistentVolumeClaim. Can only be created if there is already a PersistentVolume within the cluster                    |
| volumes: short-syntax  | ✓  | ✓  | ✓  | PersistentVolumeClaim                                                | Creates a PersistentVolumeClaim. Can only be created if there is already a PersistentVolume within the cluster                    |
| volumes: long-syntax   | -  | -  | ✓  | PersistentVolumeClaim                                                | Creates a PersistentVolumeClaim. Can only be created if there is already a PersistentVolume within the cluster                    |
| restart                | ✓  | ✓  | ✓  |                                                                      |                                                                                                                                   |
|                        |    |    |    |                                                                      |                                                                                                                                   |
| **Volume**             | x  | x  | x  |                                                                      |                                                                                                                                   |
| driver                 | x  | x  | x  |                                                                      |                                                                                                                                   |
| driver_opts            | x  | x  | x  |                                                                      |                                                                                                                                   |
| external               | x  | x  | x  |                                                                      |                                                                                                                                   |
| labels                 | x  | x  | x  |                                                                      |                                                                                                                                   |
|                        |    |    |    |                                                                      |                                                                                                                                   |
| **Network**            | x  | x  | x  |                                                                      |                                                                                                                                   |
| driver                 | x  | x  | x  |                                                                      |                                                                                                                                   |
| driver_opts            | x  | x  | x  |                                                                      |                                                                                                                                   |
| enable_ipv6            | x  | x  | x  |                                                                      |                                                                                                                                   |
| ipam                   | x  | x  | x  |                                                                      |                                                                                                                                   |
| internal               | x  | x  | x  |                                                                      |                                                                                                                                   |
| labels                 | x  | x  | x  |                                                                      |                                                                                                                                   |
| external               | x  | x  | x  |                                                                      |                                                                                                                                   |
|                        |    |    |    |                                                                      |                                                                                                                                   |
| **Configs**            | x  | x  | x  |                                                                      |                                                                                                                                   |
| environment            | x  | ✓  | ✓  |                                                                      |                                                                                                                                   |
| file                   | ✓  | ✓  | ✓  |                                                                      |                                                                                                                                   |
| content                | x  | ✓  | ✓  |                                                                      |                                                                                                                                   |
| labels                 | x  | x  | x  |                                                                      |                                                                                                                                   |
| external               | x  | x  | x  |                                                                      |                                                                                                                                   |

---

### Development (`docs/development.md`)

---
layout: default
permalink: /development/
title: Development
redirect_from: 
  - /docs/development.md/
  - /docs/development/
---

# Development Guide

## Building Kompose

Read about building kompose [here](https://github.com/kubernetes/kompose#development-and-building-of-kompose).

## Workflow

### Fork the main repository

1. Go to https://github.com/kubernetes/kompose
2. Click the "Fork" button (at the top right)

### Clone your fork

The commands below require that you have `$GOPATH`. We highly recommended you put the Kompose code into your `$GOPATH`.

```console
git clone https://github.com/$YOUR_GITHUB_USERNAME/kompose.git $GOPATH/src/github.com/kubernetes/kompose
cd $GOPATH/src/github.com/kubernetes/kompose
git remote add upstream 'https://github.com/kubernetes/kompose'
```

### Create a branch and make changes

```console
git checkout -b myfeature
# Make your code changes
```

### Keeping your development fork in sync

```console
git fetch upstream
git rebase upstream/main
```

Note: If you have write access to the main repository at github.com/kubernetes/kompose, you should modify your git configuration so that you can't accidentally push to upstream:

```console
git remote set-url --push upstream no_push
```

### Committing changes to your fork

```console
git commit
git push -f origin myfeature
```

### Creating a pull request

1. Visit https://github.com/$YOUR_GITHUB_USERNAME/kompose.git
2. Click the "Compare and pull request" button next to your "myfeature" branch.
3. Check out the pull request process for more details

## Go Modules and dependency management

Kompose uses [Go Modules](https://github.com/golang/go/wiki/Modules) to manage dependencies.
If you want to introduce changes to dependencies, please ensure that `go.mod` and `go.sum` are updated properly.

##### Updating Kubernetes and OpenShift

Kubernetes version depends on what version is OpenShift using.
OpenShift is using forked Kubernetes to carry some patches.
Currently, it is not possible to use a different Kubernetes version from the version that OpenShift uses.
(for more see comments in `go.mod`)

### Adding CLI tests

[Kompose CLI tests](https://github.com/kubernetes/kompose/tree/main/script/test/cmd) run `kompose convert` with compose files, and cross-check the k8s and OpenShift artifacts generated with the template files.



### CI

For Kompose, we use numerous CI's:

- [TravisCI](https://travis-ci.org/kubernetes/kompose): Unit and CLI tests
- [SemaphoreCI](https://semaphoreci.com/cdrage/kompose-2): Integration / cluster tests
- [Fabric8CI](http://jenkins.cd.k8s.fabric8.io/): Secondary integration tests / future cluster tests

---

### Installation (`docs/installation.md`)

---
layout: default
permalink: /installation/
title: Installation
redirect_from:
  - /docs/installation.md/
  - /docs/installation/
---

# Installation

* TOC
{:toc}

We have multiple ways to install Kompose. Our preferred (and most up-to-date) method is downloading the binary from the latest GitHub release.

## GitHub release

Kompose is released via GitHub, you can see all current releases on the [GitHub release page](https://github.com/kubernetes/kompose/releases).

This is the **recommended** way of installing Kompose.

**Linux and macOS:**

```sh
# Linux
curl -L https://github.com/kubernetes/kompose/releases/download/v1.38.0/kompose-linux-amd64 -o kompose

# Linux ARM64
curl -L https://github.com/kubernetes/kompose/releases/download/v1.38.0/kompose-linux-arm64 -o kompose

# macOS
curl -L https://github.com/kubernetes/kompose/releases/download/v1.38.0/kompose-darwin-amd64 -o kompose

# macOS ARM64
curl -L https://github.com/kubernetes/kompose/releases/download/v1.38.0/kompose-darwin-arm64 -o kompose

chmod +x kompose
sudo mv ./kompose /usr/local/bin/kompose
```

**Windows:**

Download from [GitHub](https://github.com/kubernetes/kompose/releases/download/v1.38.0/kompose-windows-amd64.exe) and add the binary to your PATH.

## Go

Installing using `go install` pulls from the main branch with the latest development changes.

```sh
go install github.com/kubernetes/kompose@latest
```

## CentOS

Kompose is in [EPEL](https://fedoraproject.org/wiki/EPEL) (Available in EPEL 7 package repository) CentOS repository.
If you don't have [EPEL](https://fedoraproject.org/wiki/EPEL) repository already installed and enabled you can do it by running `sudo yum install epel-release`

If you have [EPEL](https://fedoraproject.org/wiki/EPEL) enabled in your system, you can install Kompose like any other package.

```bash
sudo yum -y install kompose
```

## macOS

On macOS, you can install the latest release via [Homebrew](https://brew.sh) or [MacPorts](https://www.macports.org/).

```bash
brew install kompose
```

## Windows

Kompose can be installed via [Chocolatey](https://chocolatey.org/packages/kubernetes-kompose)

```console
choco install kubernetes-kompose
```

or using winget

```console
winget install Kubernetes.kompose
```

## Docker

You can build an image from the official repo for [Docker](https://docs.docker.com/engine/reference/commandline/build/) or [Podman](https://docs.podman.io/en/latest/markdown/podman-build.1.html):

```bash
docker build -t kompose https://github.com/kubernetes/kompose.git\#main
```

To run the built image against the current directory, run the following command:

```bash
docker run --rm -it -v $PWD:/opt -w /opt kompose kompose convert
```

---

### Integrations (`docs/integrations.md`)

---
layout: default
permalink: /integrations/
title: Integrations
redirect_from:
  - /docs/integrations.md/
  - /docs/integrations/
---

# Integrations

* TOC
{:toc}

There are some projects out there known to use Kompose integrated in some form or another

### Kompose UI by Jad Chamoun (ICANN) and Joe Haddad (Anghami)

**Description:** "A web interface to convert Compose files to Kubernetes YAML"

**Link:** [https://github.com/JadCham/komposeui](https://github.com/JadCham/komposeui)

### Kompose Docker Container by Cloudfind

**Description:** "A Docker container for the Kompose translator for compose"

**Link:** [https://github.com/cloudfind/kompose-docker](https://github.com/cloudfind/kompose-docker)

### KPM by CoreOS

**Description:** "KPM is a tool to deploy and manage application stacks on Kubernetes"

**Link:** [https://github.com/coreos/kpm](https://github.com/coreos/kpm)

### Docker Image for Adobe Enterprise Manager by Adfinis SyGroup AG

**Description:** "Docker Image for Adobe Enterprise Manager"

**Link:** [https://github.com/adfinis-sygroup/aem-docker/tree/master](https://github.com/adfinis-sygroup/aem-docker/tree/master)

### Kompose Ansible Playbook by Chris Houseknecht (Red Hat)

**Description:** "Download and unarchive the latest kompose release asset for your OS"

**Link:** [https://github.com/chouseknecht/kompose-install-role](https://github.com/chouseknecht/kompose-install-role)

### Fabric8 Maven Plugin by Red Hat

**Description:** "Maven is one of the widely used build tools for Java applications. The Fabric8 Maven Plugin is a maven extension that simplifies the deployment of Java applications to Kubernetes or OpenShift clusters.
The main task of this plugin is to build Docker images, generate Kubernetes or OpenShift resource descriptors and run/deploy the application on Kubernetes or OpenShift cluster.
The plugin has a wide range of configuration options. Compose is one of the options to bring up deployments on Kubernetes or OpenShift clusters.
Technically, Fabric8 Maven Plugin processes the external compose.yml file and generates Kubernetes or OpenShift resources via Kompose."

**Links:**

* [Quickstart](/maven-example)
* [Documentation](https://maven.fabric8.io/#compose)

---

### Maven Example (`docs/maven-example.md`)

---
layout: default
permalink: /maven-example/
title: Maven Example
redirect_from:
  - /docs/maven-example.md/
  - /docs/maven-example/
---

# Fabric8 Maven Plugin + Kompose:

Let's deploy a Springboot Java application with Compose file using Fabric8 Maven Plugin to Kubernetes or OpenShift.

##### Requirements

- Linux or MacOS or Windows
- JDK 1.7+ - [JDK Quick Installation Guide](http://openjdk.java.net/install/)
- Maven 3.x+ - [Maven Installation Guide](http://www.baeldung.com/install-maven-on-windows-linux-mac)
- Kompose - [Kompose Installation Guide](/installation)

**1. Clone the example project from GitHub**

```bash
$ git clone https://github.com/piyush1594/kompose-maven-example.git
```

Change current directory to `kompose-maven-example` directory.

```bash
$ cd kompose-maven-example
```

**2. Add Fabric8 Maven Plugin to your project**

```bash
$ mvn io.fabric8:fabric8-maven-plugin:3.5.28:setup
```

Add the Fabric8 Maven Plugin configuration to `pom.xml` of project. `pom.xml` is manifest or deployment descriptor file of a maven project.

**3. Install Kompose through Maven**

```bash
$ mvn fabric8:install
```

This command installs the `kompose` on the host.

**4. Configure Fabric8 Maven Plugin to use a Compose file**

```bash
<plugin>
  <groupId>io.fabric8</groupId>
  <artifactId>fabric8-maven-plugin</artifactId>
  <configuration>
    <composeFile>path for docker compose file</composeFile>
  </configuration>
  <executions>
    <execution>
      <goals>
        <goal>resource</goal>
        <goal>build</goal>
      </goals>
    </execution>
  </executions>
</plugin>
```

Add the `<configuration>` and `<executions>` sections to `pom.xml` as shown in above `pom.xml` snippet. Update the `<composeFile>` to provide the relative path of Compose file from `pom.xml`

**5. Deploy application on Kubernetes or OpenShift**

Make sure that Kubernetes/OpenShift cluster or Minikube/Minishift is running. In case, if anything of this is not running, you can run Minishift to test this application by using the following command.

```bash
$ minishift start
```

Below command deploys this application on Kubernetes or OpenShift.

```bash
$ mvn fabric8:deploy
```

Now that your service has been deployed, let's access it by querying `pod`, `service` from Kubernetes or OpenShift.

```bash
$ oc get pods
NAME                                    READY     STATUS      RESTARTS   AGE
springboot-compose-1-xl0vb       1/1       Running     0          5m
springboot-compose-s2i-1-build   0/1       Completed   0          7m
```

```bash
$ oc get svc
NAME                        CLUSTER-IP       EXTERNAL-IP   PORT(S)    AGE
springboot-compose   172.30.205.137   <none>        8080/TCP   6m
```

Let's access the Springboot service.

```bash
$ minishift openshift service --in-browser springboot-compose
Created the new window in existing browser session.
```

It will open your application endpoint in default browser.

---

### User Guide (`docs/user-guide.md`)

---
layout: default
permalink: /user-guide/
title: User Guide
redirect_from:
  - /docs/user-guide.md/
  - /docs/user-guide/
---

# User Guide

## Table of contents

* [Kompose conversion example](#kompose-conversion-example)
* [CLI Modifications](#cli-modifications)
* [Labels](#labels)
* [Restart Policy](#restart-policy)
* [Building and Pushing Images](#building-and-pushing-images)

## Kompose Conversion Example

Kompose has support for two providers: OpenShift and Kubernetes.
You can choose a targeted provider using global option `--provider`. If no provider is specified, Kubernetes is set by default.

### Kubernetes

```sh
$ kompose --file compose.yaml convert
```

You can also provide multiple compose files at the same time:

```sh
$ kompose -f compose.yaml -f compose.yaml convert
```

When multiple compose files are provided the configuration is merged. Any configuration that is common will be over ridden by subsequent file.

You can provide your compose files via environment variables as following:
```sh
$ COMPOSE_FILE="compose.yaml alternative-compose.yaml" kompose convert
```

### OpenShift

```sh
$ kompose --provider openshift --file compose.yaml convert
```

## CLI Modifications

On the command line, you can modify the output of the generated YAML. For example, using alternative controllers such as [Replication Controllers](http://kubernetes.io/docs/user-guide/replication-controller/) objects, [Daemon Sets](https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/), or [Statefulset](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/).


Daemon Set example:

```sh
$ kompose convert --controller daemonSet
```

A full list of these options can be found on `kompose convert --help`.

## Labels

`kompose` supports Kompose-specific labels within the `compose.yaml` file to get you the rest of the way there.

Labels are an important kompose concept as they allow you to add Kubernetes modifications without having to edit the YAML afterwards. For example, adding an init container, or a custom readiness check.

| Key / Value | Description / Example |
|-----|-------------|
| [`kompose.controller.port.expose`](#komposecontrollerportexpose) | Expose as hostPort on the controller (not recommended) |
| `Boolean` | `false` |
| [`kompose.controller.type`](#komposecontrollertype) | Type of the controller |
| `String` | `deployment`, `daemonset`, `replicationcontroller`, `statefulset` |
| [`kompose.cronjob.backoff_limit`](#komposecronjobbackoff_limit) | Number of retries before marked as failed |
| `Integer` | `6` |
| [`kompose.cronjob.concurrency_policy`](#komposecronjobconcurrency_policy) | Handling of concurrent jobs |
| `String` | `Forbid`, `Allow`, `Never` |
| [`kompose.cronjob.schedule`](#komposecronjobschedule) | Schedule |
| `String` | `1 * * * *` |
| [`kompose.hpa.cpu`](#komposehpacpu) | CPU utilization percentage that triggers autoscaling |
| `Percentage` | `50%` |
| [`kompose.hpa.memory`](#komposehpamemory) | Memory utilization threshold that triggers autoscaling |
| `String` | `200Mi` |
| [`kompose.hpa.replicas.max`](#komposehpareplicasmax) | Max pod replicas for Horizontal Pod Autoscaler |
| `Integer` | `10` |
| [`kompose.hpa.replicas.min`](#komposehpareplicasmin) | Min pod replicas for Horizontal Pod Autoscaler |
| `Integer` | `2` |
| [`kompose.image-pull-policy`](#komposeimage-pull-policy) | Policy for pulling images |
| `String` | `Always`, `IfNotPresent`, `Never` |
| [`kompose.image-pull-secret`](#komposeimage-pull-secret) | Secret to be used for pulling images from a private registry |
| `String` | `myregistrykey` |
| [`kompose.init.containers.command`](#komposeinitcontainerscommand) | Command to be executed |
| `Array` | `["printenv"]` |
| [`kompose.init.containers.image`](#komposeinitcontainersimage) | Image to be used |
| `String` | `busybox` |
| [`kompose.init.containers.name`](#komposeinitcontainersname) | Name assigned |
| `String` | `init-mydb` |
| [`kompose.security-context.fsgroup`](#komposesecurity-contextfsgroup) | Filesystem group ID for the pods' volumes |
| `Integer` | `1001` |
| [`kompose.service.external-traffic-policy`](#komposeserviceexternal-traffic-policy) | Policy to route external traffic |
| `String` | `cluster`, `local` |
| [`kompose.service.expose`](#komposeserviceexpose) | Creates a Ingress or Route. Accepts domain or 'true' for auto-generating a domain. |
| `String` | `true,domain1.com,domain2.com` |
| [`kompose.service.expose.ingress-class-name`](#komposeserviceexposeingress-class-name) | Ingress class to be used for exposing services |
| `String` | `nginx` |
| [`kompose.service.expose.tls-secret`](#komposeserviceexposetls-secret) | TLS secret for securing ingress |
| `String` | `my-tls-secret` |
| [`kompose.service.group`](#komposeservicegroup) | Label to group multiple containers in a single pod |
| `String` | `mygroup` |
| [`kompose.service.healthcheck.liveness.http_get_path`](#komposeservicehealthchecklivenesshttp_get_path) | HTTP GET path for liveness probe |
| `String` | `/health` |
| [`kompose.service.healthcheck.liveness.http_get_port`](#komposeservicehealthchecklivenesshttp_get_port) | HTTP GET port for liveness probe |
| `Integer` | `8080` |
| [`kompose.service.healthcheck.liveness.tcp_port`](#komposeservicehealthchecklivenesstcp_port) | TCP socket port for liveness probe |
| `Integer` | `3306` |
| [`kompose.service.healthcheck.readiness.disable`](#komposeservicehealthcheckreadinessdisable) | Whether to disable the readiness probe |
| `Boolean` | `true` |
| [`kompose.service.healthcheck.readiness.http_get_path`](#komposeservicehealthcheckreadinesshttp_get_path) | HTTP GET path for readiness probe |
| `String` | `/ready` |
| [`kompose.service.healthcheck.readiness.http_get_port`](#komposeservicehealthcheckreadinesshttp_get_port) | HTTP GET port for readiness probe |
| `Integer` | `8081` |
| [`kompose.service.healthcheck.readiness.interval`](#komposeservicehealthcheckreadinessinterval) | Interval between readiness checks |
| `Duration` | `10s` |
| [`kompose.service.healthcheck.readiness.retries`](#komposeservicehealthcheckreadinessretries) | Number of times readiness probe should retry before failing |
| `Integer` | `3` |
| [`kompose.service.healthcheck.readiness.start_period`](#komposeservicehealthcheckreadinessstart_period) | Initial delay before starting the readiness probe |
| `Duration` | `30s` |
| [`kompose.service.healthcheck.readiness.tcp_port`](#komposeservicehealthcheckreadinesstcp_port) | TCP socket port for readiness probe |
| `Integer` | `3307` |
| [`kompose.service.healthcheck.readiness.test`](#komposeservicehealthcheckreadinesstest) | Command or script run by the readiness probe |
| `Array` | `["CMD", "echo", "OK"]` |
| [`kompose.service.healthcheck.readiness.timeout`](#komposeservicehealthcheckreadinesstimeout) | Timeout for a single readiness probe |
| `Duration` | `5s` |
| [`kompose.service.nodeport.port`](#komposeservicenodeportport) | Specific port number to be used as NodePort |
| `Integer` | `30000` |
| [`kompose.service.type`](#komposeservicetype) | Type of service |
| `String` | `nodeport`, `clusterip`, `loadbalancer`, `headless` |
| [`kompose.volume.size`](#komposevolumesize) | Size of the volume |
| `String` | `1Gi` |
| [`kompose.volume.storage-class-name`](#komposevolumestorage-class-name) | StorageClassName for provisioning volumes |
| `String` | `standard` |
| [`kompose.volume.subpath`](#komposevolumesubpath) | Subpath inside the mounted volume |
| `String` | `/data` |
| [`kompose.volume.type`](#komposevolumetype) | Type of Kubernetes volume |
| `String` | `configMap`, `persistentVolumeClaim`, `emptyDir`, `hostPath` |

### kompose.controller.port.expose

```yaml
services:
  web:
    image: wordpress:latest
    ports:
      - '80:80'
    labels:
      kompose.controller.expose.port: true
```

### kompose.controller.type

```yaml
services:
  web:
    image: wordpress:latest
    ports:
      - '80:80'
    labels:
      kompose.controller.type: deployment
```

### kompose.cronjob.backoff_limit

```yaml
services:
  cron-job:
    image: busybox
    labels:
      kompose.cronjob.backoff_limit: 3
```

### kompose.cronjob.concurrency_policy

```yaml
services:
  periodic-task:
    image: busybox
    labels:
      kompose.cronjob.concurrency_policy: Forbid
```

### kompose.cronjob.schedule

```yaml
services:
  cron-job:
    image: busybox
    labels:
      kompose.cronjob.schedule: "*/5 * * * *"
```

### kompose.hpa.cpu

```yaml
services:
  web:
    image: nginx
    labels:
      kompose.hpa.cpu: 80
```

### kompose.hpa.memory

```yaml
services:
  db:
    image: mysql
    labels:
      kompose.hpa.memory: 512Mi
```

### kompose.hpa.replicas.max

```yaml
services:
  api:
    image: custom-api
    labels:
      kompose.hpa.replicas.max: 10
```

### kompose.hpa.replicas.min

```yaml
services:
  api:
    image: custom-api
    labels:
      kompose.hpa.replicas.min: 2
```

### kompose.image-pull-policy

```yaml
services:
  example-service:
    image: example-image
    labels:
      kompose.image-pull-policy: "IfNotPresent"
```

### kompose.image-pull-secret

```yaml
services:
  private-service:
    image: private-repo/image:tag
    labels:
      kompose.image-pull-secret: "my-private-registry-key"
```

### kompose.init.containers.command

```yaml
services:
  init-service:
    image: busybox
    labels:
      kompose.init.containers.command: ["echo", "Initializing..."]
```

### kompose.init.containers.image

```yaml
services:
  init-service:
    image: busybox
    labels:
      kompose.init.containers.image: busybox
```

### kompose.init.containers.name

```yaml
services:
  init-service:
    image: busybox
    labels:
      kompose.init.containers.name: "initial-setup"
```

### kompose.security-context.fsgroup

```yaml
services:
  secured-service:
    image: nginx
    labels:
      kompose.security-context.fsgroup: 2000
```

### kompose.service.external-traffic-policy

```yaml
services:
  front-end:
    image: quay.io/kompose/web
    ports:
      - 8080:8080
    labels:
      kompose.service.external-traffic-policy: local
```

### kompose.service.expose

```yaml
services:
  web-app:
    image: nginx
    ports:
      - 80:80
    labels:
      kompose.service.expose: "example.com"
```

### kompose.service.expose.ingress-class-name

```yaml
services:
  web:
    image: nginx
    ports:
      - 80:80
    labels:
      kompose.service.expose.ingress-class-name: "nginx"
```

### kompose.service.expose.tls-secret

```yaml
services:
  web:
    image: nginx
    ports:
      - 443:443
    labels:
      kompose.service.expose.tls-secret: "my-ssl-secret"
```

### kompose.service.group

```yaml
version: "3"

services:
  nginx:
    image: nginx
    depends_on:
      - logs
    labels:
      - kompose.service.group=sidecar

  logs:
    image: busybox
    command: ["tail -f /var/log/nginx/access.log"]
    labels:
      - kompose.service.group=sidecar
```

### kompose.service.healthcheck.liveness.http_get_path

```yaml
services:
  web:
    image: custom-web
    ports:
      - "8080:8080"
    labels:
      kompose.service.healthcheck.liveness.http_get_path: /health
```

### kompose.service.healthcheck.liveness.http_get_port

```yaml
services:
  web:
    image: custom-web
    ports:
      - "8080:8080"
    labels:
      kompose.service.healthcheck.liveness.http_get_port: 8080
```

### kompose.service.healthcheck.liveness.tcp_port

```yaml
services:
  db:
    image: mysql
    ports:
      - "3306:3306"
    labels:
      kompose.service.healthcheck.liveness.tcp_port: 3306
```

### kompose.service.healthcheck.readiness.disable

```yaml
services:
  web:
    image: custom-web
    labels:
      kompose.service.healthcheck.readiness.disable: true
```

### kompose.service.healthcheck.readiness.http_get_path

```yaml
services:
  web:
    image: custom-web
    labels:
      kompose.service.healthcheck.readiness.http_get_path: /ready
```

### kompose.service.healthcheck.readiness.http_get_port

```yaml
services:
  web:
    image: custom-web
    labels:
      kompose.service.healthcheck.readiness.http_get_port: 8081
```

### kompose.service.healthcheck.readiness.interval

```yaml
services:
  web:
    image: custom-web
    labels:
      kompose.service.healthcheck.readiness.interval: 10s
```

### kompose.service.healthcheck.readiness.retries

```yaml
services:
  web:
    image: custom-web
    labels:
      kompose.service.healthcheck.readiness.retries: 3
```

### kompose.service.healthcheck.readiness.start_period

```yaml
services:
  web:
    image: custom-web
    labels:
      kompose.service.healthcheck.readiness.start_period: 30s
```

### kompose.service.healthcheck.readiness.tcp_port

```yaml
services:
  db:
    image: mysql
    labels:
      kompose.service.healthcheck.readiness.tcp_port: 3307
```

### kompose.service.healthcheck.readiness.test

```yaml
services:
  web:
    image: custom-web
    labels:
      kompose.service.healthcheck.readiness.test: ["CMD", "curl", "-f", "http://localhost:8081/ready"]
```

### kompose.service.healthcheck.readiness.timeout

```yaml
services:
  web:
    image: custom-web
    labels:
      kompose.service.healthcheck.readiness.timeout: 5s
```

### kompose.service.nodeport.port

```yaml
services:
  web:
    image: nginx
    ports:
      - "30000:80"
    labels:
      kompose.service.nodeport.port: 30000
```

### kompose.service.type

```yaml
services:
  web:
    image: nginx
    ports:
      - "80:80"
    labels:
      kompose.service.type: nodeport
```

### kompose.volume.size

```yaml
services:
  db:
    image: postgres:10.1
    labels:
      kompose.volume.size: 1Gi
    volumes:
      - db-data:/var/lib/postgresql/data
```

### kompose.volume.storage-class-name

```yaml
services:
  db:
    image: postgres:10.1
    labels:
      kompose.volume.storage-class-name: custom-storage-class-name
    volumes:
      - db-data:/var/lib/postgresql/data
```

### kompose.volume.subpath

```yaml
services:
  pgadmin:
    image: postgres
    labels:
      kompose.volume.subpath: pg-data
```

### kompose.volume.type

```yaml
services:
  db:
    image: postgres
    labels:
      kompose.volume.type: persistentVolumeClaim
    volumes:
      - db-data:/var/lib/postgresql/data
```

## Restart Policy

If you want to create normal pods without a controller you can use the `restart` construct of compose to define that. Follow the table below to see what happens on the `restart` value.

| `compose` `restart` | object created    | Pod `restartPolicy` |
|---------------------|-------------------|---------------------|
| `""`                | controller object | `Always`            |
| `always`            | controller object | `Always`            |
| `unless-stopped`    | controller object | `Always`            |
| `on-failure`        | Pod / CronJob     | `OnFailure`         |
| `no`                | Pod / CronJob     | `Never`             |

**Note**: controller object could be `deployment`, `replicationcontroller`, etc.

For example, the `pival` service will become a pod down here. This container calculated the value of `pi`.

```yaml
version: '2'

services:
  pival:
    image: perl
    command: ["perl",  "-Mbignum=bpi", "-wle", "print bpi(2000)"]
    restart: "on-failure"
```

For example, the `pival` service will become a cron job down here. This container calculated the value of `pi` every minute.

```yaml
version: '2'

services:
  pival:
    image: perl
    command: ["perl",  "-Mbignum=bpi", "-wle", "print bpi(2000)"]
    restart: "no"
    labels:
      kompose.cronjob.schedule: "* * * * *"
      kompose.cronjob.concurrency_policy: "Forbid"
      kompose.cronjob.backoff_limit: "0"
```

#### Warning about Deployment Configs

If the 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.

If the Compose file has a service name with `_` or `.` in it (e.g., `web_service` or `web.service`), then it will be replaced by `-` and the service name will be renamed accordingly (e.g., `web-service`). Kompose does this because "Kubernetes" doesn't allow `_` in object names.

Please note that changing the service name might break some `compose` files.

## Building and Pushing Images

If the Compose file has `build` or `build:context, build:dockerfile` keys, build will run when `--build` specified.

And Image will push to _docker.io_ (default) when `--push-image=true` specified.

It is possible to push to a custom registry by specifying `--push-image-registry`, which will override the registry from the image name.

### Authentication on Registry

Kompose uses the docker authentication from file `$DOCKER_CONFIG/config.json`, `$HOME/.docker/config.json`, and `$HOME/.dockercfg` after `docker login`.

**This only works fine on Linux but macOS would fail when using `"credsStore": "osxkeychain"`.**

However, there is an approach to push successfully on macOS, by not using `osxkeychain` for `credsStore`. To disable `osxkeychain`:

- remove `credsStore` from the `config.json` file, and `docker login` again.
- for some docker desktop versions, there is a setting `Securely store Docker logins in macOS keychain`, which should be unchecked. Then restart docker desktop if needed, and `docker login` again.

Now `config.json` should contain base64 encoded passwords, then push image should succeed. Working, but not safe though! Use it at your risk.

For Windows, there is also `credsStore` which is `wincred`. Technically it will fail on authentication as macOS does, but you can try the approach above like macOS too.

### Custom Build and Push

If you want to customize the build and push processes and use another containers solution than Docker,
Kompose offers you the possibility to do that. You can use `--build-command` and `--push-command` flags
to achieve that.

e.g: `kompose -f convert --build-command 'whatever command --you-use' --push-command 'whatever command --you-use'`

---

###  Data Dates.Yml (`docs/_data/dates.yml`)

- date: "Saturday May 8"
  green: 20
  yellow: 20
  red: 20
- date: "Monday May 17"
  green: 20
  yellow: 20
  red: 20
- date: "Monday May 31"
  green: 20
  yellow: 20
  red: 20
- date: "Monday June 7"
  green: 20
  yellow: 20
  red: 20
- date: "Monday June 14"
  green: 20
  yellow: 20
  red: 20
- date: "Monday June 21"
  green: 20
  yellow: 20
  red: 20
- date: "Monday July 5"
  green: 20
  yellow: 20
  red: 20
- date: "Monday July 19"
  green: 20
  yellow: 20
  red: 20
- date: "Monday July 26"
  green: 20
  yellow: 20
  red: 20
- date: "Monday August 9"
  green: 20
  yellow: 20
  red: 20
- date: "Monday August 16"
  green: 20
  yellow: 20
  red: 20
- date: "Monday August 23"
  green: 20
  yellow: 20
  red: 20
- date: "Monday August 30"
  green: 20
  yellow: 20
  red: 20
- date: "Monday September 13"
  green: 20
  yellow: 20
  red: 20
- date: "Friday September 24"
  green: 20
  yellow: 20
  red: 20
- date: "Monday September 27"
  green: 20
  yellow: 20
  red: 20
- date: "Monday October 4"
  green: 20
  yellow: 20
  red: 20
- date: "Sunday October 10"
  green: 20
  yellow: 20
  red: 20

---

###  Data Menu.Yml (`docs/_data/menu.yml`)

other_links:
  "Installation": "/installation/"
  "Getting Started": "/getting-started/"
  "User Guide": "/user-guide/"
  "Conversion Matrix": "/conversion/"
  "Architecture": "/architecture/"

---

--- METRICS ---
- Files Extracted: 18
- Estimated Token Budget: ~19092 tokens
- Canonical Reference: https://codewiki.google/github.com/kubernetes/kompose
