Skip to content

Instantly share code, notes, and snippets.

@welshstew
Last active May 19, 2022 13:06
Show Gist options
  • Save welshstew/e170e243d12ac917769eef262d26959e to your computer and use it in GitHub Desktop.
Save welshstew/e170e243d12ac917769eef262d26959e to your computer and use it in GitHub Desktop.
pdb-demonstration
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
name: example
spec:
selector:
app: httpd
replicas: 3
template:
metadata:
labels:
app: httpd
spec:
containers:
- name: httpd
image: >-
image-registry.openshift-image-registry.svc:5000/openshift/httpd:latest
ports:
- containerPort: 8080
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- httpd
topologyKey: "kubernetes.io/hostname"
strategy:
type: Rolling
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx-app
template:
metadata:
labels:
app: nginx-app
spec:
containers:
- name: nginx
image: quay.io/swinches/nginx-ex:latest
ports:
- containerPort: 80
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- nginx-app
topologyKey: "kubernetes.io/hostname"
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx-app
template:
metadata:
labels:
app: nginx-app
spec:
containers:
- name: nginx
image: quay.io/swinches/nginx-ex:latest
ports:
- containerPort: 80
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- nginx-app
topologyKey: "kubernetes.io/hostname"
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: nginx-pdb
spec:
minAvailable: 2
selector:
matchLabels:
app: nginx-app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment