Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Kuberenetes templates and deployment guide #1962

Merged
merged 8 commits into from
Mar 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Pre-built [cvat_server](https://hub.docker.com/r/openvino/cvat_server) and
[cvat_ui](https://hub.docker.com/r/openvino/cvat_ui) images were published on DockerHub (<https://github.com/openvinotoolkit/cvat/pull/2766>)
- Project task subsets (<https://github.com/openvinotoolkit/cvat/pull/2774>)
- Kubernetes templates and guide for their deployment (<https://github.com/openvinotoolkit/cvat/pull/1962>)
- [WiderFace](http://shuoyang1213.me/WIDERFACE/) format support (<https://github.com/openvinotoolkit/cvat/pull/2864>)
- [VGGFace2](https://github.com/ox-vgg/vgg_face2) format support (<https://github.com/openvinotoolkit/cvat/pull/2865>)

Expand Down
4 changes: 4 additions & 0 deletions kubernetes-templates/01_namespace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: cvat
12 changes: 12 additions & 0 deletions kubernetes-templates/02_cvat_backend_storage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: cvat-backend-data
namespace: cvat
spec:
accessModes:
- ReadWriteOnce
storageClassName: standard
resources:
requests:
storage: 20Gi
13 changes: 13 additions & 0 deletions kubernetes-templates/02_database_secrets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: cvat-postgres-secret
namespace: cvat
labels:
app: cvat-app
tier: db
stringData:
POSTGRES_DB: cvat
POSTGRES_USER: root
POSTGRES_PASSWORD: POSTGRES_ADMIN_PW
12 changes: 12 additions & 0 deletions kubernetes-templates/02_database_storage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: cvat-postgres-data
namespace: cvat
spec:
accessModes:
- ReadWriteOnce
storageClassName: standard
resources:
requests:
storage: 20Gi
61 changes: 61 additions & 0 deletions kubernetes-templates/03_database_deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: cvat-postgres
namespace: cvat
labels:
app: cvat-app
tier: db
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: cvat-app
tier: db
template:
metadata:
labels:
app: cvat-app
tier: db
spec:
containers:
- name: cvat-postgres
image: postgres:10.3-alpine
imagePullPolicy: "IfNotPresent"
env:
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
name: cvat-postgres-secret
key: POSTGRES_DB
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: cvat-postgres-secret
key: POSTGRES_USER
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: cvat-postgres-secret
key: POSTGRES_PASSWORD
ports:
- containerPort: 5432
readinessProbe:
exec:
command:
- sh
- -c
- su - postgres -c "pg_isready --host=$POD_IP"
initialDelaySeconds: 15
timeoutSeconds: 2
resources: {}
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: postgredb
subPath: postgres
volumes:
- name: postgredb
persistentVolumeClaim:
claimName: cvat-postgres-data
29 changes: 29 additions & 0 deletions kubernetes-templates/03_redis_deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: cvat-redis
namespace: cvat
labels:
app: cvat-app
tier: redis-app
spec:
replicas: 1
selector:
matchLabels:
app: cvat-app
tier: redis-app
template:
metadata:
labels:
app: cvat-app
tier: redis-app
spec:
containers:
- image: redis:4.0.5-alpine
name: cvat-redis
imagePullPolicy: Always
ports:
- containerPort: 6379
resources:
limits:
cpu: "0.1"
96 changes: 96 additions & 0 deletions kubernetes-templates/04_cvat_backend_deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: cvat-backend
namespace: cvat
labels:
app: cvat-app
tier: backend
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: cvat-app
tier: backend
template:
metadata:
labels:
app: cvat-app
tier: backend
spec:
containers:
- name: cvat-backend-app-container
image: openvino/cvat_server:v1.2.0
imagePullPolicy: Always
resources:
requests:
cpu: 10m
memory: 100Mi
env:
- name: DJANGO_MODWSGI_EXTRA_ARGS
value: ""
- name: UI_PORT
value: "80"
- name: UI_HOST
value: "cvat-frontend-service"
- name: ALLOWED_HOSTS
value: "*"
- name: CVAT_REDIS_HOST
value: "cvat-redis-service"
- name: CVAT_POSTGRES_HOST
value: "cvat-postgres-service"
- name: CVAT_POSTGRES_USER
valueFrom:
secretKeyRef:
name: cvat-postgres-secret
key: POSTGRES_USER
- name: CVAT_POSTGRES_DBNAME
valueFrom:
secretKeyRef:
name: cvat-postgres-secret
key: POSTGRES_DB
- name: CVAT_POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: cvat-postgres-secret
key: POSTGRES_PASSWORD
ports:
- containerPort: 8080
volumeMounts:
- mountPath: /home/django/data
name: cvat-backend-data
subPath: data
- mountPath: /home/django/keys
name: cvat-backend-data
subPath: keys
- mountPath: /home/django/logs
name: cvat-backend-data
subPath: logs
- mountPath: /home/django/models
name: cvat-backend-data
subPath: models
initContainers:
- name: user-data-permission-fix
image: busybox
command: ["/bin/chmod", "-R", "777", "/home/django"]
volumeMounts:
- mountPath: /home/django/data
name: cvat-backend-data
subPath: data
- mountPath: /home/django/keys
name: cvat-backend-data
subPath: keys
- mountPath: /home/django/logs
name: cvat-backend-data
subPath: logs
- mountPath: /home/django/models
name: cvat-backend-data
subPath: models
volumes:
- name: cvat-backend-data
persistentVolumeClaim:
claimName: cvat-backend-data
imagePullSecrets:
- name: gitlab-registry
29 changes: 29 additions & 0 deletions kubernetes-templates/04_cvat_frontend_deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: cvat-frontend
namespace: cvat
labels:
app: cvat-app
tier: frontend
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: cvat-app
tier: frontend
template:
metadata:
labels:
app: cvat-app
tier: frontend
spec:
containers:
- name: cvat-frontend-app-container
image: openvino/cvat_ui:v1.2.0
imagePullPolicy: Always
ports:
- containerPort: 80
resources: {}
18 changes: 18 additions & 0 deletions kubernetes-templates/04_database_service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
name: cvat-postgres-service
namespace: cvat
labels:
app: cvat-app
tier: db
spec:
type: ClusterIP
selector:
app: cvat-app
tier: db
ports:
- port: 5432
targetPort: 5432
protocol: TCP
name: http
18 changes: 18 additions & 0 deletions kubernetes-templates/04_redis_service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
name: cvat-redis-service
namespace: cvat
labels:
app: cvat-app
tier: redis-app
spec:
type: ClusterIP
selector:
app: cvat-app
tier: redis-app
ports:
- port: 6379
targetPort: 6379
protocol: TCP
name: http
18 changes: 18 additions & 0 deletions kubernetes-templates/05_cvat_backend_service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
name: cvat-backend-service
namespace: cvat
labels:
app: cvat-app
tier: backend
spec:
type: ClusterIP
selector:
app: cvat-app
tier: backend
ports:
- port: 8080
targetPort: 8080
protocol: TCP
name: http
18 changes: 18 additions & 0 deletions kubernetes-templates/05_cvat_frontend_service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
name: cvat-frontend-service
namespace: cvat
labels:
app: cvat-app
tier: frontend
spec:
type: ClusterIP
selector:
app: cvat-app
tier: frontend
ports:
- port: 80
targetPort: 80
protocol: TCP
name: http
Loading