-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add public-samples/trail-project-1-n75ia4/infrastructure/kubernetes/w…
…eb/deployment.yaml
- Loading branch information
1 parent
02fbd9a
commit cf8d854
Showing
1 changed file
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |