diff --git a/Servers/Containerization/Kubernetes/Migrating Docker-Compose.yml to k8s.md b/Servers/Containerization/Kubernetes/Migrating Docker-Compose.yml to k8s.md index f5a724b..c3f866e 100644 --- a/Servers/Containerization/Kubernetes/Migrating Docker-Compose.yml to k8s.md +++ b/Servers/Containerization/Kubernetes/Migrating Docker-Compose.yml to k8s.md @@ -12,137 +12,137 @@ This will attempt to convert the `docker-compose.yml` file into a Kubernetes man === "docker-compose.yml" -``` yaml -version: "2.1" -services: - ntfy: - image: binwiederhier/ntfy - container_name: ntfy - command: - - serve - environment: - - NTFY_ATTACHMENT_CACHE_DIR=/var/lib/ntfy/attachments - - NTFY_BASE_URL=https://ntfy.bunny-lab.io - - TZ=America/Denver # optional: Change to your desired timezone - #user: UID:GID # optional: Set custom user/group or uid/gid - volumes: - - /srv/containers/ntfy/cache:/var/cache/ntfy - - /srv/containers/ntfy/etc:/etc/ntfy - ports: - - 80:80 - restart: always - networks: - docker_network: - ipv4_address: 192.168.5.45 + ``` yaml + version: "2.1" + services: + ntfy: + image: binwiederhier/ntfy + container_name: ntfy + command: + - serve + environment: + - NTFY_ATTACHMENT_CACHE_DIR=/var/lib/ntfy/attachments + - NTFY_BASE_URL=https://ntfy.bunny-lab.io + - TZ=America/Denver # optional: Change to your desired timezone + #user: UID:GID # optional: Set custom user/group or uid/gid + volumes: + - /srv/containers/ntfy/cache:/var/cache/ntfy + - /srv/containers/ntfy/etc:/etc/ntfy + ports: + - 80:80 + restart: always + networks: + docker_network: + ipv4_address: 192.168.5.45 -networks: - default: - external: - name: docker_network - docker_network: - external: true -``` + networks: + default: + external: + name: docker_network + docker_network: + external: true + ``` === "compose-k8s.yaml" -``` yaml ---- -apiVersion: v1 -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: + ``` yaml + --- + apiVersion: v1 + 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: - 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 + ports: + - name: "80" + port: 80 + targetPort: 80 + selector: + io.kompose.service: ntfy ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - labels: - io.kompose.service: ntfy-claim0 - name: ntfy-claim0 -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 100Mi + --- + 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: + 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 -kind: PersistentVolumeClaim -metadata: - labels: - io.kompose.service: ntfy-claim1 - name: ntfy-claim1 -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 100Mi -``` + --- + apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + labels: + io.kompose.service: ntfy-claim0 + name: ntfy-claim0 + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi + + --- + apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + labels: + io.kompose.service: ntfy-claim1 + name: ntfy-claim1 + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi + ```