Deployment in Kubernetes
1. Introduction
2. Manual deployment
2.1 Introduction
kubectl apply -f manifest.yamlapiVersion: v1
kind: Namespace
metadata:
name: facephi-voice-service
---
apiVersion: v1
kind: Secret
metadata:
name: voice-license-secret
namespace: facephi-voice-service
stringData:
stringData:
config.cfg: |-
{
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: voice-service-deployment
namespace: facephi-voice-service
spec:
selector:
matchLabels:
name: facephi-voice-service
template:
metadata:
labels:
name: facephi-voice-service
spec:
volumes:
- name: config-volume
secret:
secretName: voice-license-secret
defaultMode: 420
containers:
- name: facephi-voice-service-container-name
# Use the name and Version of your image
image: >-
facephicorp.jfrog.io/docker-pro-fphi/facephi-voice-service:$VERSION
env:
# Optional JWT protection
# - name: FACEPHI_VOICE_REST_AUTH_ENABLED
# value: "true"
# - name: FACEPHI_VOICE_REST_AUTH_JWT_SECRET
# value: "shared-secret"
# - name: FACEPHI_VOICE_REST_AUTH_ACCEPT_AUTHORIZATION_HEADER
# value: "true"
# - name: FACEPHI_VOICE_REST_AUTH_ACCEPT_API_KEY_HEADER
# value: "true"
# - name: FACEPHI_VOICE_REST_AUTH_API_KEY_HEADER_NAME
# value: "x-api-key"
ports:
- name: http
containerPort: 6982
protocol: TCP
resources:
limits:
cpu: '8'
memory: 8Gi
requests:
cpu: 500m
memory: 3Gi
volumeMounts:
- name: config-volume
readOnly: true
mountPath: /service/config/config.cfg
subPath: config.cfg
livenessProbe:
httpGet:
path: /api/v1/health
port: 6982
scheme: HTTP
initialDelaySeconds: 10
timeoutSeconds: 5
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
readinessProbe:
httpGet:
path: /api/v1/health
port: 6982
scheme: HTTP
initialDelaySeconds: 15
timeoutSeconds: 5
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
imagePullPolicy: IfNotPresent
restartPolicy: Always
terminationGracePeriodSeconds: 60
---
apiVersion: v1
kind: Service
metadata:
name: voice-service
namespace: facephi-voice-service
spec:
ports:
- name: http
protocol: TCP
port: 80
targetPort: 6982
type: ClusterIP
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: voice-ingress
namespace: facephi-voice-service
spec:
ingressClassName: kong
rules:
- http:
paths:
- path: /api(/v1)?/(.*)
pathType: Prefix
backend:
service:
name: voice-service
port:
number: 80
---2.2 Volumes
2.3 Resources
CPU
Memory
Average time
CPU
Memory
Average time
2.4 Service
2.4.1 LoadBalancer
2.5 Ingress
3 Instance Types
Instance type
CPU
Memory
Service Pod capacity
Last updated