Files
myceliumcloud-examples/examples/nginx-load-balancer/nginx-load-balancer-deployment.yaml

64 lines
1.6 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-load-balancer
labels:
app: nginx-load-balancer
spec:
replicas: 3
selector:
matchLabels:
app: nginx-load-balancer
template:
metadata:
labels:
app: nginx-load-balancer
spec:
hostNetwork: false
dnsPolicy: ClusterFirst
# Hard requirement: worker nodes only (not master nodes)
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node-role.kubernetes.io/master
operator: DoesNotExist
- key: node-role.kubernetes.io/control-plane
operator: DoesNotExist
containers:
- name: nginx
image: nginx:alpine
ports:
- containerPort: 8080
volumeMounts:
- name: html-content
mountPath: /usr/share/nginx/html
- name: nginx-config
mountPath: /etc/nginx/conf.d
resources:
requests:
memory: "64Mi"
cpu: "100m"
limits:
memory: "128Mi"
cpu: "200m"
livenessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 5
periodSeconds: 5
volumes:
- name: html-content
configMap:
name: nginx-load-balancer-content
- name: nginx-config
configMap:
name: nginx-load-balancer-nginx-config