manifests/today_ai_weather/load.yaml
songtianlun 06ac637fd8 feat: change deployment to daemonset with scheduling rules
- Change kind from Deployment to DaemonSet
- Remove previous node selector configuration
- Add tolerations for scheduling restrictions
- Introduce node affinity for specific hostnames

These changes facilitate deployment across all nodes instead of a single replica,
allowing for improved resource utilization and management in the
Kubernetes environment.
2025-04-21 16:08:57 +08:00

108 lines
2.8 KiB
YAML

apiVersion: apps/v1
#kind: Deployment
kind: DaemonSet
metadata:
name: app
namespace: taw
labels:
app: taw
spec:
#replicas: 1
selector:
matchLabels:
app: taw
template:
metadata:
annotations: {}
labels:
app: taw
spec:
#nodeSelector:
# region: us
# dc: vkus
tolerations:
- key: "scheduling"
operator: "Equal"
value: "restricted"
effect: "NoSchedule"
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- vkvm-us1
- vkvm-us2
- zgocloud-us1
containers:
- name: app
image: songtianlun/today_ai_weather:main
imagePullPolicy: Always
ports:
- containerPort: 3000
name: web
env:
- name: DATABASE_URL
value: "postgresql://postgres:JG5haZAVcqpkYQtW@pg.taw.svc.cluster.local:5432/taw"
#value: "postgresql://taw:BEhQkRSw3eGPti2c@8.134.120.243:5432/today_ai_weather"
#value: "postgresql://taw:BEhQkRSw3eGPti2c@172.26.12.25:5432/today_ai_weather"
- name: REDIS_URL
value: "redis://redis.taw.svc.cluster.local:6379/0"
- name: RAILS_ENV
value: "production"
- name: RAILS_LOG_LEVEL
value: "info"
- name: RAILS_MASTER_KEY
value: "a1f61bf46afa19f4ca54d99638f6e7ce"
- name: TZ
value: "Asia/Shanghai"
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: tasks
namespace: taw
labels:
app: tasks
spec:
replicas: 1
selector:
matchLabels:
app: tasks
template:
metadata:
annotations: {}
labels:
app: tasks
spec:
nodeSelector:
region: us
containers:
- name: tasks
image: songtianlun/today_ai_weather:main
imagePullPolicy: Always
command: ["bundle"]
args: ["exec", "sidekiq"]
env:
- name: DATABASE_URL
value: "postgresql://postgres:JG5haZAVcqpkYQtW@pg.taw.svc.cluster.local:5432/taw"
#value: "postgresql://taw:BEhQkRSw3eGPti2c@8.134.120.243:5432/today_ai_weather"
#value: "postgresql://taw:BEhQkRSw3eGPti2c@172.26.12.25:5432/today_ai_weather"
- name: REDIS_URL
value: "redis://redis.taw.svc.cluster.local:6379/0"
- name: RAILS_ENV
value: "production"
- name: RAILS_LOG_LEVEL
value: "info"
- name: RAILS_MASTER_KEY
value: "a1f61bf46afa19f4ca54d99638f6e7ce"
- name: TZ
value: "Asia/Shanghai"
---