Update Servers/Containerization/Kubernetes/Migrating Docker-Compose.yml to k8s.md
All checks were successful
GitOps Automatic Deployment / GitOps Automatic Deployment (push) Successful in 7s

This commit is contained in:
2025-12-14 01:58:18 -07:00
parent b1d8cc5ca5
commit 1efe60c2b3

View File

@@ -1,16 +1,19 @@
# Migrating `docker-compose.yml` to Rancher RKE2 Cluster # Migrating `docker-compose.yml` to Rancher RKE2 Cluster
You may be comfortable operating with Portainer or `docker-compose`, but there comes a point where you might want to migrate those existing workloads to a Kubernetes cluster as easily-as-possible. Lucklily, there is a way to do this using a tool called "**Kompose**'. Follow the instructions seen below to convert and deploy your existing `docker-compose.yml` into a Kubernetes cluster such as Rancher RKE2. You may be comfortable operating with Portainer or `docker-compose`, but there comes a point where you might want to migrate those existing workloads to a Kubernetes cluster as easily-as-possible. Lucklily, there is a way to do this using a tool called "**Kompose**'. Follow the instructions seen below to convert and deploy your existing `docker-compose.yml` into a Kubernetes cluster such as Rancher RKE2.
!!! info "RKE2 Cluster Deployment"
This document assumes that you have an existing Rancher RKE2 cluster deployed. If not, you can deploy one following the [Deploy RKE2 Cluster](https://docs.bunny-lab.io/Servers/Containerization/Kubernetes/Deployment/Rancher RKE2/) documentation.
## Installing Kompose ## Installing Kompose
The first step involves downloading Kompose from https://kompose.io/installation. Once you have it downloaded and installed onto your environment of choice, save a copy of your `docker-compose.yml` file somewhere on-disk, then open up a terminal and run the following command: The first step involves downloading Kompose from https://kompose.io/installation. Once you have it downloaded and installed onto your environment of choice, save a copy of your `docker-compose.yml` file somewhere on-disk, then open up a terminal and run the following command:
```sh ```sh
kompose --file docker-compose.yaml convert --stdout > compose-k8s.yaml kompose --file docker-compose.yaml convert --stdout > ntfy-k8s.yaml
``` ```
This will attempt to convert the `docker-compose.yml` file into a Kubernetes manifest YAML file. The Before and after example can be seen below: This will attempt to convert the `docker-compose.yml` file into a Kubernetes manifest YAML file. The Before and after example can be seen below:
=== "docker-compose.yml" === "(Original) docker-compose.yml"
``` yaml ``` yaml
version: "2.1" version: "2.1"
@@ -43,7 +46,7 @@ This will attempt to convert the `docker-compose.yml` file into a Kubernetes man
external: true external: true
``` ```
=== "compose-k8s.yaml" === "(Converted) ntfy-k8s.yaml"
``` yaml ``` yaml
--- ---