experiment with pod affinity
This commit is contained in:
parent
9b7da0a01d
commit
e888430474
|
@ -5,3 +5,11 @@ bases:
|
||||||
resources:
|
resources:
|
||||||
- nextcloud-deployment.yaml
|
- nextcloud-deployment.yaml
|
||||||
- nextcloud-ingress.yaml
|
- nextcloud-ingress.yaml
|
||||||
|
|
||||||
|
commonLabels:
|
||||||
|
app.kubernetes.io/name: nextcloud
|
||||||
|
|
||||||
|
# TODO
|
||||||
|
# patchesStrategicmerge:
|
||||||
|
# - patches/postgres-podaffinity-patch.yaml
|
||||||
|
# - patches/redis-podaffinity-patch.yaml
|
|
@ -4,6 +4,7 @@ metadata:
|
||||||
name: nextcloud
|
name: nextcloud
|
||||||
labels:
|
labels:
|
||||||
app.kubernetes.io/name: nextcloud
|
app.kubernetes.io/name: nextcloud
|
||||||
|
app.kubernetes.io/component: server
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
strategy:
|
strategy:
|
||||||
|
@ -11,22 +12,32 @@ spec:
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app.kubernetes.io/name: nextcloud
|
app.kubernetes.io/name: nextcloud
|
||||||
|
app.kubernetes.io/component: server
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app.kubernetes.io/name: nextcloud
|
app.kubernetes.io/name: nextcloud
|
||||||
|
app.kubernetes.io/component: server
|
||||||
spec:
|
spec:
|
||||||
affinity:
|
affinity:
|
||||||
nodeAffinity:
|
nodeAffinity:
|
||||||
# prefer to not be on a server node (resource contention)
|
|
||||||
preferredDuringSchedulingIgnoredDuringExecution:
|
preferredDuringSchedulingIgnoredDuringExecution:
|
||||||
- weight: 1
|
- weight: 1
|
||||||
preference:
|
preference:
|
||||||
matchExpressions:
|
matchExpressions:
|
||||||
- key: kubernetes.io/hostname
|
- key: node-role.kubernetes.io/master
|
||||||
operator: NotIn
|
operator: DoesNotExist
|
||||||
values:
|
# podAffinity:
|
||||||
- k3s-s0
|
# preferredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
# - weight: 2
|
||||||
|
# podAffinityTerm:
|
||||||
|
# labelSelector:
|
||||||
|
# matchExpressions:
|
||||||
|
# - key: app.kubernetes.io/name
|
||||||
|
# operator: In
|
||||||
|
# values:
|
||||||
|
# - nextcloud
|
||||||
|
# topologyKey: kubernetes.io/hostname
|
||||||
containers:
|
containers:
|
||||||
- name: nextcloud
|
- name: nextcloud
|
||||||
image: nextcloud
|
image: nextcloud
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: StatefulSet
|
||||||
|
metadata:
|
||||||
|
name: postgres
|
||||||
|
spec:
|
||||||
|
template:
|
||||||
|
spec:
|
||||||
|
affinity:
|
||||||
|
podAffinity:
|
||||||
|
preferredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
- weight: 1
|
||||||
|
podAffinityTerm:
|
||||||
|
labelSelector:
|
||||||
|
matchExpressions:
|
||||||
|
- key: app.kubernetes.io/name
|
||||||
|
operator: In
|
||||||
|
values:
|
||||||
|
- nextcloud
|
||||||
|
topologyKey: kubernetes.io/hostname
|
|
@ -0,0 +1,19 @@
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: redis
|
||||||
|
spec:
|
||||||
|
template:
|
||||||
|
spec:
|
||||||
|
affinity:
|
||||||
|
podAffinity:
|
||||||
|
preferredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
- weight: 1
|
||||||
|
podAffinityTerm:
|
||||||
|
labelSelector:
|
||||||
|
matchExpressions:
|
||||||
|
- key: app.kubernetes.io/name
|
||||||
|
operator: In
|
||||||
|
values:
|
||||||
|
- nextcloud
|
||||||
|
topologyKey: kubernetes.io/hostname
|
|
@ -3,17 +3,17 @@ kind: StatefulSet
|
||||||
metadata:
|
metadata:
|
||||||
name: postgres
|
name: postgres
|
||||||
labels:
|
labels:
|
||||||
app.kubernetes.io/name: postgres
|
app.kubernetes.io/component: postgres
|
||||||
spec:
|
spec:
|
||||||
serviceName: postgres
|
serviceName: postgres
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app.kubernetes.io/name: postgres
|
app.kubernetes.io/component: postgres
|
||||||
replicas: 1
|
replicas: 1
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app.kubernetes.io/name: postgres
|
app.kubernetes.io/component: postgres
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: postgres
|
- name: postgres
|
||||||
|
|
|
@ -3,16 +3,16 @@ kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: redis
|
name: redis
|
||||||
labels:
|
labels:
|
||||||
app.kubernetes.io/name: redis
|
app.kubernetes.io/component: redis
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app.kubernetes.io/name: redis
|
app.kubernetes.io/component: redis
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app.kubernetes.io/name: redis
|
app.kubernetes.io/component: redis
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: redis
|
- name: redis
|
||||||
|
|
Loading…
Reference in New Issue