Kubernetes Deployments

Prerequisites

What Is A Deployment

ReplicaSets v.s. Deployments

A Deployment Example

apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment-demo
spec:
selector:
matchLabels:
app: nginx
env: demo
replicas: 3
strategy:
rollingUpdate:
maxUnavailable: 0
template:
metadata:
labels:
app: nginx
env: demo
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: failure-domain.beta.kubernetes.io/zone
operator: In
values:
- us-central1-a
- us-central1-b
- us-central1-c
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- nginx
topologyKey: kubernetes.io/hostname
containers:
- name: nginx
image: nginx:1.15.3
ports:
- containerPort: 80

Metadata

Deployment Spec and Pod Template

Pod Selector

Replica

Rolling Update Strategies

Pod Affinity

What Is Next

Reference

--

--

A software engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store