Deployment on Kubernetes
1. Introduction
2. Manual deployment
2.1 Introduction
kubectl apply -f manifest.yamlapiVersion: v1
kind: Namespace
metadata:
name: facephi-ocr-service
---
apiVersion: v1
kind: Secret
metadata:
name: ocr-license-secret
namespace: facephi-ocr-service
stringData:
license.lic: |-
{
CONFIG_DIR=<provided by facephi>
LICENSE_TYPE=<provided by facephi>
LICENSE_BEHAVIOUR=<provided by facephi>
LICENSE_ID=<provided by facephi>
LICENSE_DATA=<provided by facephi>
LICENSE_KEY=<provided by facephi>
}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: ocr
namespace: facephi-ocr-service
spec:
replicas: 3
selector:
matchLabels:
app: ocr
template:
metadata:
labels:
app: ocr
spec:
volumes:
- name: license-volume
secret:
secretName: ocr-license-secret
defaultMode: 420
containers:
- name: facephi-ocr-service
image: facephicorp.jfrog.io/docker-pro-fphi/facephi-ocr-service:2.4.6
imagePullPolicy: IfNotPresent
ports:
- containerPort: 6982
env:
# Optional JWT protection
# - name: FACEPHI_OCR_REST_AUTH_ENABLED
# value: "true"
# - name: FACEPHI_OCR_REST_AUTH_JWT_SECRET
# valueFrom:
# secretKeyRef:
# name: ocr-jwt-secret
# key: shared-secret
# - name: FACEPHI_OCR_REST_AUTH_ACCEPT_AUTHORIZATION_HEADER
# value: "true"
# - name: FACEPHI_OCR_REST_AUTH_ACCEPT_API_KEY_HEADER
# value: "false"
# - name: FACEPHI_OCR_REST_AUTH_API_KEY_HEADER_NAME
# value: "x-api-key"
volumeMounts:
- name: license-volume
readOnly: true
mountPath: /service/license/license.lic
subPath: license.lic
resources:
limits:
cpu: 1024m
memory: 2Gi
requests:
cpu: 512m
memory: 1Gi
---
apiVersion: v1
kind: Service
metadata:
name: ocr-service
namespace: facephi-ocr-service
spec:
ports:
- name: http
protocol: TCP
port: 80
targetPort: 6982
selector:
app: ocr
type: ClusterIP
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ocr-ingress
namespace: facephi-ocr-service
annotations:
konghq.com/strip-path: "true"
spec:
ingressClassName: kong
rules:
- host: <your own dns for this service>
http:
paths:
- path: /ocr
pathType: Prefix
backend:
service:
name: ocr-service
port:
number: 80
---
2.2 Secret
2.3 Deployment
2.3.1 Volumes
2.3.2 Resources
Service
CPU
Memory
Average time
2.4 Service
2.4.1 LoadBalancer
2.5 Ingress
3. Instance types
Instance type
CPU
Memory
OCR pod capacity
Last updated