Deployment is an object that maintains a group of identical Pods. The following is how Deployment maintains Pods.
- Ensures that the Pods have the same configuration
- Monitors the health of the Pods
- Provides declarative updates for the Pods
Here’s a sample Deployment configuration file.
apiVersion: apps/v1
kind: Deployment
metadata:
name: client-deployment
spec:
# replicas is used to specify the number of Pods we want to have running
replicas: 1
# selector is used to tell Deployment which Pods we want it to maintain
selector:
matchLabels:
component: web
# template is used to tell Deployment to create Pods with this template (configuration)
template:
metadata:
labels:
component: web
spec:
containers:
- name: client
image: thealiilman/a-react-app
ports:
- containerPort: 3000