75 lines
1.9 KiB
YAML
75 lines
1.9 KiB
YAML
# https://kubernetes.io/docs/concepts/workloads/controllers/deployment/
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: server-manager
|
|
namespace: server-manager
|
|
spec:
|
|
selector:
|
|
matchLabels:
|
|
app: server-manager
|
|
replicas: 1
|
|
strategy:
|
|
rollingUpdate:
|
|
maxSurge: 25%
|
|
maxUnavailable: 25%
|
|
type: RollingUpdate
|
|
template:
|
|
metadata:
|
|
annotations:
|
|
kubectl.kubernetes.io/default-container: server-manager
|
|
labels:
|
|
app: server-manager
|
|
spec:
|
|
# initContainers:
|
|
# Init containers are exactly like regular containers, except:
|
|
# - Init containers always run to completion.
|
|
# - Each init container must complete successfully before the next one starts.
|
|
containers:
|
|
- name: server-manager
|
|
image: myjob:latest
|
|
imagePullPolicy: IfNotPresent
|
|
resources:
|
|
requests:
|
|
cpu: 100m
|
|
memory: 100Mi
|
|
limits:
|
|
cpu: 100m
|
|
memory: 100Mi
|
|
livenessProbe:
|
|
tcpSocket:
|
|
port: 80
|
|
initialDelaySeconds: 5
|
|
timeoutSeconds: 5
|
|
successThreshold: 1
|
|
failureThreshold: 3
|
|
periodSeconds: 10
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /_status/healthz
|
|
port: 80
|
|
initialDelaySeconds: 5
|
|
timeoutSeconds: 2
|
|
successThreshold: 1
|
|
failureThreshold: 3
|
|
periodSeconds: 10
|
|
env:
|
|
- name: DB_HOST
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: server-manager
|
|
key: DB_HOST
|
|
ports:
|
|
- containerPort: 80
|
|
name: server-manager
|
|
volumeMounts:
|
|
- name: localtime
|
|
mountPath: /etc/localtime
|
|
volumes:
|
|
- name: localtime
|
|
hostPath:
|
|
path: /usr/share/zoneinfo/Asia/Taipei
|
|
restartPolicy: Always
|
|
---
|
|
|