From c1145a6dc603a72ad5ef34384735fd55628db65c Mon Sep 17 00:00:00 2001 From: alex289 Date: Sun, 3 Sep 2023 09:49:57 +0200 Subject: [PATCH] feat: Split kubernetes deployments --- k8s-deployment.yml | 170 ------------------------- k8s-deployments/clean-architecture.yml | 34 +++++ k8s-deployments/rabbitmq.yml | 47 +++++++ k8s-deployments/redis.yml | 42 ++++++ k8s-deployments/sql-server.yml | 37 ++++++ 5 files changed, 160 insertions(+), 170 deletions(-) delete mode 100644 k8s-deployment.yml create mode 100644 k8s-deployments/clean-architecture.yml create mode 100644 k8s-deployments/rabbitmq.yml create mode 100644 k8s-deployments/redis.yml create mode 100644 k8s-deployments/sql-server.yml diff --git a/k8s-deployment.yml b/k8s-deployment.yml deleted file mode 100644 index c2432c4..0000000 --- a/k8s-deployment.yml +++ /dev/null @@ -1,170 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: clean-architecture-deployment -spec: - replicas: 1 - selector: - matchLabels: - app: clean-architecture-app - template: - metadata: - labels: - app: clean-architecture-app - spec: - containers: - - name: clean-architecture-app - # Replace this with the path to your built image - image: alexdev28/clean-architecture:latest - ports: - - containerPort: 80 - ---- -apiVersion: v1 -kind: Service -metadata: - name: clean-architecture -spec: - selector: - app: clean-architecture-app - ports: - - protocol: TCP - port: 80 - targetPort: 80 - type: LoadBalancer - ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: sql-server-deployment -spec: - replicas: 1 - selector: - matchLabels: - app: sql-server - template: - metadata: - labels: - app: sql-server - spec: - containers: - - name: sql-server - image: mcr.microsoft.com/mssql/server:latest - env: - - name: ACCEPT_EULA - value: "Y" - - name: SA_PASSWORD - value: "Password123!#" - ports: - - containerPort: 1433 - ---- -apiVersion: v1 -kind: Service -metadata: - name: sql-server -spec: - selector: - app: sql-server - ports: - - protocol: TCP - port: 1433 - targetPort: 1433 - ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: redis-deployment -spec: - replicas: 1 - selector: - matchLabels: - app: redis - template: - metadata: - labels: - app: redis - spec: - containers: - - name: redis - image: docker.io/bitnami/redis:7.2 - env: - # ALLOW_EMPTY_PASSWORD is recommended only for development. - - name: ALLOW_EMPTY_PASSWORD - value: "yes" - - name: REDIS_DISABLE_COMMANDS - value: "FLUSHDB,FLUSHALL" - ports: - - containerPort: 6379 - volumeMounts: - - name: redis-data - mountPath: /bitnami/redis/data - volumes: - - name: redis-data - emptyDir: {} - ---- -apiVersion: v1 -kind: Service -metadata: - name: redis -spec: - selector: - app: redis - ports: - - protocol: TCP - port: 6379 - targetPort: 6379 - ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: rabbitmq-deployment -spec: - replicas: 1 - selector: - matchLabels: - app: rabbitmq - template: - metadata: - labels: - app: rabbitmq - spec: - containers: - - name: rabbitmq - image: rabbitmq:3-management - ports: - - containerPort: 5672 - - containerPort: 15672 - env: - - name: RABBITMQ_DEFAULT_USER - value: admin - - name: RABBITMQ_DEFAULT_PASS - value: DOIA9234JF - volumeMounts: - - name: rabbitmq-data - mountPath: /var/lib/rabbitmq - volumes: - - name: rabbitmq-data - emptyDir: {} - ---- -apiVersion: v1 -kind: Service -metadata: - name: rabbitmq -spec: - selector: - app: rabbitmq - ports: - - name: rabbitmq-port - protocol: TCP - port: 5672 - targetPort: 5672 - - name: rabbitmq-management-port - protocol: TCP - port: 15672 - targetPort: 15672 diff --git a/k8s-deployments/clean-architecture.yml b/k8s-deployments/clean-architecture.yml new file mode 100644 index 0000000..86140d1 --- /dev/null +++ b/k8s-deployments/clean-architecture.yml @@ -0,0 +1,34 @@ +apiVersion: v1 +kind: Service +metadata: + name: clean-architecture +spec: + selector: + app: clean-architecture-app + ports: + - protocol: TCP + port: 80 + targetPort: 80 + type: LoadBalancer + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: clean-architecture-deployment +spec: + replicas: 1 + selector: + matchLabels: + app: clean-architecture-app + template: + metadata: + labels: + app: clean-architecture-app + spec: + containers: + - name: clean-architecture-app + # Replace this with the path to your built image + image: alexdev28/clean-architecture:latest + ports: + - containerPort: 80 \ No newline at end of file diff --git a/k8s-deployments/rabbitmq.yml b/k8s-deployments/rabbitmq.yml new file mode 100644 index 0000000..bfef599 --- /dev/null +++ b/k8s-deployments/rabbitmq.yml @@ -0,0 +1,47 @@ +apiVersion: v1 +kind: Service +metadata: + name: rabbitmq +spec: + selector: + app: rabbitmq + ports: + - name: rabbitmq-port + protocol: TCP + port: 5672 + targetPort: 5672 + - name: rabbitmq-management-port + protocol: TCP + port: 15672 + targetPort: 15672 + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: rabbitmq-deployment +spec: + replicas: 1 + selector: + matchLabels: + app: rabbitmq + template: + metadata: + labels: + app: rabbitmq + spec: + containers: + - name: rabbitmq + image: rabbitmq:management + ports: + - containerPort: 5672 + - containerPort: 15672 + env: + - name: RABBITMQ_DEFAULT_USER + value: admin + - name: RABBITMQ_DEFAULT_PASS + value: DOIA9234JF + resources: + requests: + cpu: 100m + memory: 100Mi \ No newline at end of file diff --git a/k8s-deployments/redis.yml b/k8s-deployments/redis.yml new file mode 100644 index 0000000..6735aad --- /dev/null +++ b/k8s-deployments/redis.yml @@ -0,0 +1,42 @@ +apiVersion: v1 +kind: Service +metadata: + name: redis +spec: + selector: + app: redis + ports: + - protocol: TCP + port: 6379 + targetPort: 6379 + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: redis-deployment +spec: + replicas: 1 + selector: + matchLabels: + app: redis + template: + metadata: + labels: + app: redis + spec: + containers: + - name: redis + image: docker.io/bitnami/redis:7.2 + env: + # ALLOW_EMPTY_PASSWORD is recommended only for development. + - name: ALLOW_EMPTY_PASSWORD + value: "yes" + - name: REDIS_DISABLE_COMMANDS + value: "FLUSHDB,FLUSHALL" + ports: + - containerPort: 6379 + resources: + requests: + cpu: 100m + memory: 100Mi \ No newline at end of file diff --git a/k8s-deployments/sql-server.yml b/k8s-deployments/sql-server.yml new file mode 100644 index 0000000..732f255 --- /dev/null +++ b/k8s-deployments/sql-server.yml @@ -0,0 +1,37 @@ +apiVersion: v1 +kind: Service +metadata: + name: sql-server +spec: + selector: + app: sql-server + ports: + - protocol: TCP + port: 1433 + targetPort: 1433 + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: sql-server-deployment +spec: + replicas: 1 + selector: + matchLabels: + app: sql-server + template: + metadata: + labels: + app: sql-server + spec: + containers: + - name: sql-server + image: mcr.microsoft.com/mssql/server:latest + env: + - name: ACCEPT_EULA + value: "Y" + - name: SA_PASSWORD + value: "Password123!#" + ports: + - containerPort: 1433 \ No newline at end of file