Skip to content

Commit

Permalink
Add public-samples/trail-project-1-n75ia4/infrastructure/kubernetes/w…
Browse files Browse the repository at this point in the history
…eb/deployment.yaml
  • Loading branch information
siddhantpp committed Dec 30, 2024
1 parent 02fbd9a commit cf8d854
Showing 1 changed file with 82 additions and 0 deletions.
82 changes: 82 additions & 0 deletions infrastructure/kubernetes/web/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: web-deployment
namespace: web
labels:
app: task-management-web
tier: frontend
environment: production
spec:
# Initial replica count of 2 for high availability
replicas: 2
selector:
matchLabels:
app: task-management-web
# Zero-downtime rolling update strategy
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
template:
metadata:
labels:
app: task-management-web
tier: frontend
# Prometheus monitoring annotations
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "80"
prometheus.io/path: "/metrics"
spec:
# Pod-level security context
securityContext:
runAsNonRoot: true
runAsUser: 1000
fsGroup: 2000
containers:
- name: web
image: task-management/web:latest
imagePullPolicy: Always
ports:
- containerPort: 80
protocol: TCP
name: http
# Resource requests and limits based on application profiling
resources:
requests:
cpu: "100m"
memory: "256Mi"
limits:
cpu: "500m"
memory: "512Mi"
# Environment configuration from ConfigMap
envFrom:
- configMapRef:
name: web-config
# Liveness probe for container health monitoring
livenessProbe:
httpGet:
path: /health
port: 80
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
# Readiness probe for traffic routing
readinessProbe:
httpGet:
path: /ready
port: 80
initialDelaySeconds: 15
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 2
# Container-level security context
securityContext:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL

0 comments on commit cf8d854

Please sign in to comment.