Skip to content

Commit

Permalink
Merge pull request #6 from vany0114/k8s
Browse files Browse the repository at this point in the history
K8s
  • Loading branch information
vany0114 authored Mar 1, 2020
2 parents 33c7f78 + 53c69fd commit a508961
Show file tree
Hide file tree
Showing 158 changed files with 668 additions and 7,537 deletions.
18 changes: 18 additions & 0 deletions deploy/k8s/local/dashboard-adminuser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: admin-user
namespace: kubernetes-dashboard
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: admin-user
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: admin-user
namespace: kubernetes-dashboard
23 changes: 23 additions & 0 deletions deploy/k8s/local/external-system/payment-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: payment
spec:
selector:
matchLabels:
app: payment
replicas: 1
template:
metadata:
labels:
app: payment
spec:
containers:
- name: payment
image: vany0114/externalsystem.paymentservice
imagePullPolicy: Always
env:
- name: ASPNETCORE_ENVIRONMENT
value: "Development"
ports:
- containerPort: 80
12 changes: 12 additions & 0 deletions deploy/k8s/local/external-system/payment-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: payment
spec:
selector:
app: payment
ports:
- name: http
protocol: TCP
port: 80
targetPort: 80
38 changes: 38 additions & 0 deletions deploy/k8s/local/invoice/invoice-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: invoice
spec:
selector:
matchLabels:
app: invoice
replicas: 3
template:
metadata:
labels:
app: invoice
spec:
containers:
- name: invoice
image: vany0114/duber.invoice.api
imagePullPolicy: Always
resources:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "256Mi"
cpu: "500m"
env:
- name: ASPNETCORE_ENVIRONMENT
value: "Development"
- name: ConnectionStrings__InvoiceDB
value: "Server=sql-data;Database=Duber.InvoiceDb;User Id=sa;Password=Pass@word"
- name: EventBusConnection
value: "rabbitmq"
- name: PaymentServiceBaseUrl
value: "http://payment"
- name: AzureServiceBusEnabled
value: "False"
ports:
- containerPort: 80
13 changes: 13 additions & 0 deletions deploy/k8s/local/invoice/invoice-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: invoice
spec:
rules:
- host: invoice.local.com
http:
paths:
- path: /
backend:
serviceName: invoice
servicePort: 80
12 changes: 12 additions & 0 deletions deploy/k8s/local/invoice/invoice-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: invoice
spec:
selector:
app: invoice
ports:
- name: http
protocol: TCP
port: 80
targetPort: 80
14 changes: 14 additions & 0 deletions deploy/k8s/local/mongo/mongo-admin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# to expose the port in order to connect with an IDE such as Studio 3T, etc

kind: Service
apiVersion: v1
metadata:
name: mongo-service
spec:
type: NodePort
selector:
app: nosql-data
ports:
- port: 27017
nodePort: 31434
name: mongo-port
22 changes: 22 additions & 0 deletions deploy/k8s/local/mongo/mongo-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nosql-data
spec:
selector:
matchLabels:
app: nosql-data
replicas: 1
template:
metadata:
labels:
app: nosql-data
spec:
containers:
- name: nosql-data
image: mongo
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 27017
protocol: TCP
13 changes: 13 additions & 0 deletions deploy/k8s/local/mongo/mongo-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: nosql-data
spec:
selector:
app: nosql-data
ports:
- port: 27017
targetPort: http
protocol: TCP
name: http
type: ClusterIP
23 changes: 23 additions & 0 deletions deploy/k8s/local/nginx-ingress/custom-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
kind: Service
apiVersion: v1
metadata:
name: ingress-nginx
namespace: ingress-nginx
labels:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
spec:
externalTrafficPolicy: Local
type: LoadBalancer
selector:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
ports:
- name: http
port: 81
protocol: TCP
targetPort: http
- name: https
port: 444
protocol: TCP
targetPort: https
14 changes: 14 additions & 0 deletions deploy/k8s/local/rabbit/rabbit-admin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# to expose the port in order to connect to the admin dashboard.

kind: Service
apiVersion: v1
metadata:
name: rabbitmq-admin
spec:
type: NodePort
selector:
app: rabbitmq
ports:
- port: 15672
nodePort: 31672
name: rabbitmq-port
22 changes: 22 additions & 0 deletions deploy/k8s/local/rabbit/rabbit-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: rabbitmq
spec:
selector:
matchLabels:
app: rabbitmq
replicas: 1
template:
metadata:
labels:
app: rabbitmq
spec:
containers:
- name: rabbitmq
image: rabbitmq:3-management
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 5672
protocol: TCP
13 changes: 13 additions & 0 deletions deploy/k8s/local/rabbit/rabbit-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: rabbitmq
spec:
selector:
app: rabbitmq
ports:
- port: 5672
targetPort: http
protocol: TCP
name: http
type: ClusterIP
14 changes: 14 additions & 0 deletions deploy/k8s/local/sql-server/sql-admin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# to expose the port in order to connect with an IDE such as SQL MS, etc

kind: Service
apiVersion: v1
metadata:
name: sql-service
spec:
type: NodePort
selector:
app: sql-data
ports:
- port: 1433
nodePort: 31433
name: sql-port
29 changes: 29 additions & 0 deletions deploy/k8s/local/sql-server/sql-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: sql-data
spec:
selector:
matchLabels:
app: sql-data
replicas: 1
template:
metadata:
labels:
app: sql-data
spec:
containers:
- name: sql-data
image: microsoft/mssql-server-linux:2017-latest
imagePullPolicy: IfNotPresent
env:
- name: ACCEPT_EULA
value: "Y"
- name: MSSQL_PID
value: Developer
- name: MSSQL_SA_PASSWORD
value: Pass@word
ports:
- name: http
containerPort: 1433
protocol: TCP
13 changes: 13 additions & 0 deletions deploy/k8s/local/sql-server/sql-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: sql-data
spec:
selector:
app: sql-data
ports:
- port: 1433
targetPort: http
protocol: TCP
name: http
type: ClusterIP
36 changes: 36 additions & 0 deletions deploy/k8s/local/trip/trip-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: trip
spec:
selector:
matchLabels:
app: trip
replicas: 1
template:
metadata:
labels:
app: trip
spec:
containers:
- name: trip
image: vany0114/duber.trip.api
imagePullPolicy: Always
resources:
requests:
memory: "128Mi"
cpu: "200m"
limits:
memory: "256Mi"
cpu: "600m"
env:
- name: ASPNETCORE_ENVIRONMENT
value: "Development"
- name: EventStoreConfiguration__ConnectionString
value: "mongodb://nosql-data"
- name: EventBusConnection
value: "rabbitmq"
- name: AzureServiceBusEnabled
value: "False"
ports:
- containerPort: 80
12 changes: 12 additions & 0 deletions deploy/k8s/local/trip/trip-hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: trip
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: trip
minReplicas: 5
maxReplicas: 10
targetCPUUtilizationPercentage: 50
13 changes: 13 additions & 0 deletions deploy/k8s/local/trip/trip-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: trip-ingress
spec:
rules:
- host: trip.local.com
http:
paths:
- path: /
backend:
serviceName: trip
servicePort: 80
Loading

0 comments on commit a508961

Please sign in to comment.