From 699d0a725d67d4b4249cd8219d08dbe93630be0a Mon Sep 17 00:00:00 2001 From: Alexander Konietzko Date: Sat, 2 Sep 2023 19:17:19 +0200 Subject: [PATCH] feat: Improve kubernetes deployment --- Readme.md | 6 ++---- k8s-deployment.yml | 17 ++++++++--------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/Readme.md b/Readme.md index 7cb783d..6761e87 100644 --- a/Readme.md +++ b/Readme.md @@ -63,10 +63,8 @@ Running the container ### Using Kubernetes -1. Change the ConnectionString in the appsettings.json to `Server=clean-architecture-db-service;Database=clean-architecture;Trusted_Connection=False;MultipleActiveResultSets=true;TrustServerCertificate=True;User Id=SA;Password=Password123!#` -2. Change the RedisHostName in the appsettings.json to `redis-service` -3. Change the RabbitMQ Host in the appsettings.json to `rabbitmq-service` -4. Build the docker image and push it to the docker hub (Change the image name in the `k8s-deployment.yml` to your own) +1. Change the ConnectionString in the appsettings.json to `Server=sql-server;Database=clean-architecture;Trusted_Connection=False;MultipleActiveResultSets=true;TrustServerCertificate=True;User Id=SA;Password=Password123!#` +2. Build the docker image and push it to the docker hub (Change the image name in the `k8s-deployment.yml` to your own) Apply the deployment file: `kubectl apply -f k8s-deployment.yml` (Delete: `kubectl delete -f k8s-deployment.yml`) diff --git a/k8s-deployment.yml b/k8s-deployment.yml index a0095db..c2432c4 100644 --- a/k8s-deployment.yml +++ b/k8s-deployment.yml @@ -1,7 +1,7 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: clean-architecture-app + name: clean-architecture-deployment spec: replicas: 1 selector: @@ -15,7 +15,7 @@ spec: containers: - name: clean-architecture-app # Replace this with the path to your built image - image: alexdev28/clean-architecture + image: alexdev28/clean-architecture:latest ports: - containerPort: 80 @@ -23,7 +23,7 @@ spec: apiVersion: v1 kind: Service metadata: - name: clean-architecture-service + name: clean-architecture spec: selector: app: clean-architecture-app @@ -37,7 +37,7 @@ spec: apiVersion: apps/v1 kind: Deployment metadata: - name: sql-server + name: sql-server-deployment spec: replicas: 1 selector: @@ -50,7 +50,7 @@ spec: spec: containers: - name: sql-server - image: mcr.microsoft.com/mssql/server + image: mcr.microsoft.com/mssql/server:latest env: - name: ACCEPT_EULA value: "Y" @@ -63,7 +63,7 @@ spec: apiVersion: v1 kind: Service metadata: - name: clean-architecture-db-service + name: sql-server spec: selector: app: sql-server @@ -71,7 +71,6 @@ spec: - protocol: TCP port: 1433 targetPort: 1433 - type: ClusterIP --- apiVersion: apps/v1 @@ -110,7 +109,7 @@ spec: apiVersion: v1 kind: Service metadata: - name: redis-service + name: redis spec: selector: app: redis @@ -156,7 +155,7 @@ spec: apiVersion: v1 kind: Service metadata: - name: rabbitmq-service + name: rabbitmq spec: selector: app: rabbitmq