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:53:59 -07:00
parent 7ca1f92291
commit b1d8cc5ca5

View File

@@ -12,137 +12,137 @@ This will attempt to convert the `docker-compose.yml` file into a Kubernetes man
=== "docker-compose.yml" === "docker-compose.yml"
``` yaml ``` yaml
version: "2.1" version: "2.1"
services: services:
ntfy: ntfy:
image: binwiederhier/ntfy image: binwiederhier/ntfy
container_name: ntfy container_name: ntfy
command: command:
- serve - serve
environment: environment:
- NTFY_ATTACHMENT_CACHE_DIR=/var/lib/ntfy/attachments - NTFY_ATTACHMENT_CACHE_DIR=/var/lib/ntfy/attachments
- NTFY_BASE_URL=https://ntfy.bunny-lab.io - NTFY_BASE_URL=https://ntfy.bunny-lab.io
- TZ=America/Denver # optional: Change to your desired timezone - TZ=America/Denver # optional: Change to your desired timezone
#user: UID:GID # optional: Set custom user/group or uid/gid #user: UID:GID # optional: Set custom user/group or uid/gid
volumes: volumes:
- /srv/containers/ntfy/cache:/var/cache/ntfy - /srv/containers/ntfy/cache:/var/cache/ntfy
- /srv/containers/ntfy/etc:/etc/ntfy - /srv/containers/ntfy/etc:/etc/ntfy
ports: ports:
- 80:80 - 80:80
restart: always restart: always
networks: networks:
docker_network: docker_network:
ipv4_address: 192.168.5.45 ipv4_address: 192.168.5.45
networks: networks:
default: default:
external: external:
name: docker_network name: docker_network
docker_network: docker_network:
external: true external: true
``` ```
=== "compose-k8s.yaml" === "compose-k8s.yaml"
``` yaml ``` yaml
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata:
annotations:
kompose.cmd: C:\ProgramData\chocolatey\lib\kubernetes-kompose\tools\kompose.exe --file ntfy.yaml convert --stdout
kompose.version: 1.37.0 (fb0539e64)
labels:
io.kompose.service: ntfy
name: ntfy
spec:
ports:
- name: "80"
port: 80
targetPort: 80
selector:
io.kompose.service: ntfy
---
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
kompose.cmd: C:\ProgramData\chocolatey\lib\kubernetes-kompose\tools\kompose.exe --file ntfy.yaml convert --stdout
kompose.version: 1.37.0 (fb0539e64)
labels:
io.kompose.service: ntfy
name: ntfy
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: ntfy
strategy:
type: Recreate
template:
metadata: metadata:
annotations: annotations:
kompose.cmd: C:\ProgramData\chocolatey\lib\kubernetes-kompose\tools\kompose.exe --file ntfy.yaml convert --stdout kompose.cmd: C:\ProgramData\chocolatey\lib\kubernetes-kompose\tools\kompose.exe --file ntfy.yaml convert --stdout
kompose.version: 1.37.0 (fb0539e64) kompose.version: 1.37.0 (fb0539e64)
labels: labels:
io.kompose.service: ntfy io.kompose.service: ntfy
name: ntfy
spec: spec:
containers: ports:
- args: - name: "80"
- serve port: 80
env: targetPort: 80
- name: NTFY_ATTACHMENT_CACHE_DIR selector:
value: /var/lib/ntfy/attachments io.kompose.service: ntfy
- name: NTFY_BASE_URL
value: https://ntfy.bunny-lab.io
- name: TZ
value: America/Denver
image: binwiederhier/ntfy
name: ntfy
ports:
- containerPort: 80
protocol: TCP
volumeMounts:
- mountPath: /var/cache/ntfy
name: ntfy-claim0
- mountPath: /etc/ntfy
name: ntfy-claim1
restartPolicy: Always
volumes:
- name: ntfy-claim0
persistentVolumeClaim:
claimName: ntfy-claim0
- name: ntfy-claim1
persistentVolumeClaim:
claimName: ntfy-claim1
--- ---
apiVersion: v1 apiVersion: apps/v1
kind: PersistentVolumeClaim kind: Deployment
metadata: metadata:
labels: annotations:
io.kompose.service: ntfy-claim0 kompose.cmd: C:\ProgramData\chocolatey\lib\kubernetes-kompose\tools\kompose.exe --file ntfy.yaml convert --stdout
name: ntfy-claim0 kompose.version: 1.37.0 (fb0539e64)
spec: labels:
accessModes: io.kompose.service: ntfy
- ReadWriteOnce name: ntfy
resources: spec:
requests: replicas: 1
storage: 100Mi selector:
matchLabels:
io.kompose.service: ntfy
strategy:
type: Recreate
template:
metadata:
annotations:
kompose.cmd: C:\ProgramData\chocolatey\lib\kubernetes-kompose\tools\kompose.exe --file ntfy.yaml convert --stdout
kompose.version: 1.37.0 (fb0539e64)
labels:
io.kompose.service: ntfy
spec:
containers:
- args:
- serve
env:
- name: NTFY_ATTACHMENT_CACHE_DIR
value: /var/lib/ntfy/attachments
- name: NTFY_BASE_URL
value: https://ntfy.bunny-lab.io
- name: TZ
value: America/Denver
image: binwiederhier/ntfy
name: ntfy
ports:
- containerPort: 80
protocol: TCP
volumeMounts:
- mountPath: /var/cache/ntfy
name: ntfy-claim0
- mountPath: /etc/ntfy
name: ntfy-claim1
restartPolicy: Always
volumes:
- name: ntfy-claim0
persistentVolumeClaim:
claimName: ntfy-claim0
- name: ntfy-claim1
persistentVolumeClaim:
claimName: ntfy-claim1
--- ---
apiVersion: v1 apiVersion: v1
kind: PersistentVolumeClaim kind: PersistentVolumeClaim
metadata: metadata:
labels: labels:
io.kompose.service: ntfy-claim1 io.kompose.service: ntfy-claim0
name: ntfy-claim1 name: ntfy-claim0
spec: spec:
accessModes: accessModes:
- ReadWriteOnce - ReadWriteOnce
resources: resources:
requests: requests:
storage: 100Mi storage: 100Mi
```
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
io.kompose.service: ntfy-claim1
name: ntfy-claim1
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi
```