Deployment is an object that maintains a group of identical Pods. The following is how Deployment maintains Pods.

  1. Ensures that the Pods have the same configuration
  2. Monitors the health of the Pods
  3. 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

Resources