Files
www.cialloo.com/script/k8s/deployment.yaml
cialloo 3dd30bb53f
All checks were successful
CI - Build and Push / Build and Push Docker Image (push) Successful in 21s
Add KUBERNETES_DEPLOYMENT_REPLICAS variable for configurable pod replicas
2025-10-06 14:59:26 +08:00

76 lines
2.1 KiB
YAML

# Kubernetes Deployment Configuration
# Deployment manages a set of identical pods and ensures desired state
apiVersion: apps/v1
kind: Deployment
metadata:
# Name of the deployment
name: ${CONTAINER_IMAGE_NAME}
# Namespace where deployment will be created
namespace: ${KUBERNETES_NAMESPACE}
labels:
app: ${CONTAINER_IMAGE_NAME}
spec:
# Number of pod replicas to run
replicas: ${KUBERNETES_DEPLOYMENT_REPLICAS}
# Label selector to identify pods managed by this deployment
selector:
matchLabels:
app: ${CONTAINER_IMAGE_NAME}
# Pod template definition
template:
metadata:
labels:
app: ${CONTAINER_IMAGE_NAME}
spec:
# Secret to pull images from private registry
imagePullSecrets:
- name: regcred
# Container specification
containers:
- name: ${CONTAINER_IMAGE_NAME}
# Docker image to use
image: ${FULL_IMAGE_NAME}
# Always pull the latest version of the image
imagePullPolicy: Always
# Container port that the app listens on
ports:
- name: http
containerPort: 80
protocol: TCP
# Health check to know when container is ready to serve traffic
readinessProbe:
httpGet:
path: /
port: http
initialDelaySeconds: 5
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
# Health check to know when to restart container
livenessProbe:
httpGet:
path: /
port: http
initialDelaySeconds: 15
periodSeconds: 20
timeoutSeconds: 5
failureThreshold: 3
# Resource limits and requests
resources:
# Minimum resources guaranteed to container
requests:
memory: "64Mi"
cpu: "100m"
# Maximum resources container can use
limits:
memory: "128Mi"
cpu: "200m"