mirror of
https://github.com/alex289/CleanArchitecture.git
synced 2025-07-01 02:52:56 +00:00
feat: Improve kubernetes deployment
This commit is contained in:
parent
f8e9ad741c
commit
699d0a725d
@ -63,10 +63,8 @@ Running the container
|
|||||||
|
|
||||||
### Using Kubernetes
|
### 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!#`
|
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. Change the RedisHostName in the appsettings.json to `redis-service`
|
2. Build the docker image and push it to the docker hub (Change the image name in the `k8s-deployment.yml` to your own)
|
||||||
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)
|
|
||||||
Apply the deployment file: `kubectl apply -f k8s-deployment.yml` (Delete: `kubectl delete -f k8s-deployment.yml`)
|
Apply the deployment file: `kubectl apply -f k8s-deployment.yml` (Delete: `kubectl delete -f k8s-deployment.yml`)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: clean-architecture-app
|
name: clean-architecture-deployment
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
selector:
|
selector:
|
||||||
@ -15,7 +15,7 @@ spec:
|
|||||||
containers:
|
containers:
|
||||||
- name: clean-architecture-app
|
- name: clean-architecture-app
|
||||||
# Replace this with the path to your built image
|
# Replace this with the path to your built image
|
||||||
image: alexdev28/clean-architecture
|
image: alexdev28/clean-architecture:latest
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 80
|
- containerPort: 80
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ spec:
|
|||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: clean-architecture-service
|
name: clean-architecture
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
app: clean-architecture-app
|
app: clean-architecture-app
|
||||||
@ -37,7 +37,7 @@ spec:
|
|||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: sql-server
|
name: sql-server-deployment
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
selector:
|
selector:
|
||||||
@ -50,7 +50,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: sql-server
|
- name: sql-server
|
||||||
image: mcr.microsoft.com/mssql/server
|
image: mcr.microsoft.com/mssql/server:latest
|
||||||
env:
|
env:
|
||||||
- name: ACCEPT_EULA
|
- name: ACCEPT_EULA
|
||||||
value: "Y"
|
value: "Y"
|
||||||
@ -63,7 +63,7 @@ spec:
|
|||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: clean-architecture-db-service
|
name: sql-server
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
app: sql-server
|
app: sql-server
|
||||||
@ -71,7 +71,6 @@ spec:
|
|||||||
- protocol: TCP
|
- protocol: TCP
|
||||||
port: 1433
|
port: 1433
|
||||||
targetPort: 1433
|
targetPort: 1433
|
||||||
type: ClusterIP
|
|
||||||
|
|
||||||
---
|
---
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
@ -110,7 +109,7 @@ spec:
|
|||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: redis-service
|
name: redis
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
app: redis
|
app: redis
|
||||||
@ -156,7 +155,7 @@ spec:
|
|||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: rabbitmq-service
|
name: rabbitmq
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
app: rabbitmq
|
app: rabbitmq
|
||||||
|
Loading…
Reference in New Issue
Block a user