From 36f02ce7386b173d2cef25ce9c88504a44a66ed7 Mon Sep 17 00:00:00 2001 From: Mikhail Shabanov Date: Thu, 7 Jan 2021 11:54:27 +0100 Subject: [PATCH] k8s first step --- docker-compose.yml | 2 +- ...-mongodblvolume-persistentvolumeclaim.yaml | 14 +++++++ k8s/mongo-deployment.yaml | 38 +++++++++++++++++++ k8s/mongo-service.yaml | 15 ++++++++ k8s/web-deployment.yaml | 32 ++++++++++++++++ k8s/web-service.yaml | 14 +++++++ 6 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 k8s/blitz-mongodblvolume-persistentvolumeclaim.yaml create mode 100644 k8s/mongo-deployment.yaml create mode 100644 k8s/mongo-service.yaml create mode 100644 k8s/web-deployment.yaml create mode 100644 k8s/web-service.yaml diff --git a/docker-compose.yml b/docker-compose.yml index 32957e5..2027ee4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: "3.9" +version: "3" services: web: image: "mike/wot-blitz-statistics-pro:latest" diff --git a/k8s/blitz-mongodblvolume-persistentvolumeclaim.yaml b/k8s/blitz-mongodblvolume-persistentvolumeclaim.yaml new file mode 100644 index 0000000..db38182 --- /dev/null +++ b/k8s/blitz-mongodblvolume-persistentvolumeclaim.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + labels: + app: blitz-mongodblvolume + name: blitz-mongodblvolume +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi +status: {} diff --git a/k8s/mongo-deployment.yaml b/k8s/mongo-deployment.yaml new file mode 100644 index 0000000..7d0d5f2 --- /dev/null +++ b/k8s/mongo-deployment.yaml @@ -0,0 +1,38 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: wot-blitz-statistics-mongo + name: wot-blitz-statistics-pro-app-mongo-deployment +spec: + replicas: 1 + selector: + matchLabels: + app: wot-blitz-statistics-mongo + strategy: + type: Recreate + template: + metadata: + labels: + app: wot-blitz-statistics-mongo + spec: + containers: + - env: + - name: MONGO_INITDB_ROOT_PASSWORD + - name: MONGO_INITDB_ROOT_USERNAME + image: mongo + imagePullPolicy: "" + name: wot-blitz-statistics-mongo + ports: + - containerPort: 27017 + resources: {} + volumeMounts: + - mountPath: /data/db + name: blitz-mongodblvolume + restartPolicy: Always + serviceAccountName: "" + volumes: + - name: blitz-mongodblvolume + persistentVolumeClaim: + claimName: blitz-mongodblvolume +status: {} diff --git a/k8s/mongo-service.yaml b/k8s/mongo-service.yaml new file mode 100644 index 0000000..57ad0f5 --- /dev/null +++ b/k8s/mongo-service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + app: wot-blitz-statistics-mongo + name: wot-blitz-statistics-pro-app-mongo-service +spec: + ports: + - name: "27027" + port: 27027 + targetPort: 27017 + selector: + app: wot-blitz-statistics-mongo + type: LoadBalancer + diff --git a/k8s/web-deployment.yaml b/k8s/web-deployment.yaml new file mode 100644 index 0000000..b0590a4 --- /dev/null +++ b/k8s/web-deployment.yaml @@ -0,0 +1,32 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: wot-blitz-statistics-web + name: wot-blitz-statistics-pro-app-web-deployment +spec: + replicas: 1 + selector: + matchLabels: + app: wot-blitz-statistics-web + strategy: {} + template: + metadata: + labels: + app: wot-blitz-statistics-web + spec: + containers: + - env: + - name: Mongo__ConnectionString + - name: Mongo__DatabaseName + - name: WargamingApi__ApplicationId + image: mike/wot-blitz-statistics-pro:v1 + imagePullPolicy: "" + name: wot-blitz-statististics-web + ports: + - containerPort: 80 + resources: {} + restartPolicy: Always + serviceAccountName: "" + volumes: null +status: {} diff --git a/k8s/web-service.yaml b/k8s/web-service.yaml new file mode 100644 index 0000000..d2f7dcc --- /dev/null +++ b/k8s/web-service.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + app: wot-blitz-statistics-web + name: wot-blitz-statistics-pro-app-web-service +spec: + selector: + app: wot-blitz-statistics-web + type: LoadBalancer + ports: + - name: "8040" + port: 8040 + targetPort: 80 \ No newline at end of file