mirror of
https://github.com/wardviaene/kubernetes-course.git
synced 2026-02-14 09:39:54 +00:00
52 lines
1.0 KiB
YAML
52 lines
1.0 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: pod-affinity-1
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: pod-affinity-1
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: pod-affinity-1
|
|
spec:
|
|
containers:
|
|
- name: k8s-demo
|
|
image: wardviaene/k8s-demo
|
|
ports:
|
|
- name: nodejs-port
|
|
containerPort: 3000
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: pod-affinity-2
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: pod-affinity-2
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: pod-affinity-2
|
|
spec:
|
|
affinity:
|
|
podAffinity:
|
|
requiredDuringSchedulingIgnoredDuringExecution:
|
|
- labelSelector:
|
|
matchExpressions:
|
|
- key: "app"
|
|
operator: In
|
|
values:
|
|
- pod-affinity-1
|
|
topologyKey: "kubernetes.io/hostname"
|
|
containers:
|
|
- name: redis
|
|
image: redis
|
|
ports:
|
|
- name: redis-port
|
|
containerPort: 6379
|