Homelab/kubernetes/apps/example-nginx/deployment.yaml

78 lines
1.4 KiB
YAML

---
# Example application deployment
# This demonstrates how FluxCD automatically deploys apps from Git
apiVersion: v1
kind: Namespace
metadata:
name: example-nginx
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
namespace: example-nginx
labels:
app: nginx
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
securityContext:
runAsNonRoot: true
runAsUser: 1001
runAsGroup: 1001
fsGroup: 1001
containers:
- name: nginx
image: nginx:1.25-alpine
ports:
- containerPort: 80
name: http
securityContext:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 200m
memory: 256Mi
livenessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 10
periodSeconds: 5
readinessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 5
periodSeconds: 3
---
apiVersion: v1
kind: Service
metadata:
name: nginx
namespace: example-nginx
spec:
selector:
app: nginx
ports:
- port: 80
targetPort: 80
name: http
type: ClusterIP