Add Kubernetes deployment, service, ingress, and namespace configurations

This commit is contained in:
2025-10-02 14:20:05 +08:00
parent cf8ebd01d3
commit a258431020
5 changed files with 381 additions and 0 deletions

View File

@@ -0,0 +1,75 @@
# 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: 2
# 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"