feat(networking): Schedule pod on primary db's node
This commit is contained in:
parent
c688bea958
commit
62b3591144
17
manifests/database-local-service.yaml
Normal file
17
manifests/database-local-service.yaml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: mastodon-db
|
||||||
|
name: mastodon-db-local
|
||||||
|
namespace: mastodon
|
||||||
|
spec:
|
||||||
|
internalTrafficPolicy: Local
|
||||||
|
ports:
|
||||||
|
- name: postgres
|
||||||
|
port: 5432
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: 5432
|
||||||
|
selector:
|
||||||
|
cnpg.io/cluster: mastodon-db
|
||||||
|
cnpg.io/instanceRole: primary
|
@ -8,7 +8,7 @@ spec:
|
|||||||
instances: 3
|
instances: 3
|
||||||
|
|
||||||
storage:
|
storage:
|
||||||
size: 1Gi
|
size: 2Gi
|
||||||
storageClass: local-path
|
storageClass: local-path
|
||||||
|
|
||||||
bootstrap:
|
bootstrap:
|
||||||
@ -50,3 +50,11 @@ spec:
|
|||||||
|
|
||||||
monitoring:
|
monitoring:
|
||||||
enablePodMonitor: true
|
enablePodMonitor: true
|
||||||
|
|
||||||
|
topologySpreadConstraints:
|
||||||
|
- maxSkew: 1
|
||||||
|
topologyKey: zone
|
||||||
|
whenUnsatisfiable: DoNotSchedule
|
||||||
|
labelSelector:
|
||||||
|
matchLabels:
|
||||||
|
cnpg.io/cluster: mastodon-db
|
||||||
|
@ -24,7 +24,19 @@ spec:
|
|||||||
operator: In
|
operator: In
|
||||||
values:
|
values:
|
||||||
- mastodon-db
|
- mastodon-db
|
||||||
|
- key: cnpg.io/instanceRole
|
||||||
|
operator: In
|
||||||
|
values:
|
||||||
|
- primary
|
||||||
topologyKey: "kubernetes.io/hostname"
|
topologyKey: "kubernetes.io/hostname"
|
||||||
|
nodeAffinity:
|
||||||
|
requiredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
nodeSelectorTerms:
|
||||||
|
- matchExpressions:
|
||||||
|
- key: "kubernetes.io/arch"
|
||||||
|
operator: In
|
||||||
|
values:
|
||||||
|
- "amd64"
|
||||||
securityContext:
|
securityContext:
|
||||||
runAsUser: 991
|
runAsUser: 991
|
||||||
runAsGroup: 991
|
runAsGroup: 991
|
||||||
@ -47,7 +59,7 @@ spec:
|
|||||||
- name: REDIS_PORT
|
- name: REDIS_PORT
|
||||||
value: "6379"
|
value: "6379"
|
||||||
- name: DB_HOST
|
- name: DB_HOST
|
||||||
value: "mastodon-db-rw.mastodon.svc.cluster.local"
|
value: "mastodon-db-local.mastodon.svc.cluster.local"
|
||||||
- name: DB_USER
|
- name: DB_USER
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
@ -117,7 +129,7 @@ spec:
|
|||||||
- mountPath: "/mastodon/public/system"
|
- mountPath: "/mastodon/public/system"
|
||||||
name: mastodon-data
|
name: mastodon-data
|
||||||
- name: mastodon-streaming
|
- name: mastodon-streaming
|
||||||
image: ghcr.io/mastodon/mastodon-streaming:v4.3.6
|
image: ghcr.io/mastodon/mastodon-streaming:v4.3.7
|
||||||
command: ["node", "./streaming/index.js"]
|
command: ["node", "./streaming/index.js"]
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 4000
|
- containerPort: 4000
|
||||||
@ -143,7 +155,7 @@ spec:
|
|||||||
- name: REDIS_PORT
|
- name: REDIS_PORT
|
||||||
value: "6379"
|
value: "6379"
|
||||||
- name: mastodon-sidekiq
|
- name: mastodon-sidekiq
|
||||||
image: ghcr.io/mastodon/mastodon:v4.3.6
|
image: ghcr.io/mastodon/mastodon:v4.3.7
|
||||||
command: ["bundle", "exec", "sidekiq"]
|
command: ["bundle", "exec", "sidekiq"]
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 9395
|
- containerPort: 9395
|
||||||
|
@ -5,8 +5,9 @@ resources:
|
|||||||
- namespace.yaml
|
- namespace.yaml
|
||||||
- secrets.yaml
|
- secrets.yaml
|
||||||
- database.yaml
|
- database.yaml
|
||||||
- deployment.yaml
|
|
||||||
- database-backup.yaml
|
- database-backup.yaml
|
||||||
|
- database-local-service.yaml
|
||||||
|
- deployment.yaml
|
||||||
- service.yaml
|
- service.yaml
|
||||||
- servicemonitor.yaml
|
- servicemonitor.yaml
|
||||||
- redis-service.yaml
|
- redis-service.yaml
|
||||||
|
Loading…
x
Reference in New Issue
Block a user