A Deployment provides declarative updates for Pods and ReplicaSets.
You describe a desired state in a Deployment, and the Deployment Controller changes the actual state to the desired state at a controlled rate. You can define Deployments to create new ReplicaSets, or to remove existing Deployments and adopt all their resources with new Deployments.
The following is an example of a Deployment. It creates a ReplicaSet to bring up three nginx Pods.
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.14.2
        ports:
        - containerPort: 80
nginx-deployment is created, indicated by the .metadata.name field..spec.replicas field..spec.selector field defines how the Deployment finds which Pods to manage. In this case, you simply select a label that is defined in the Pod template (app: nginx).template field contains the following sub-fields:
app: nginx using the .metadata.labels field..template.spec field, indicates that the Pods run one container, nginx, which runs the nginx image at version 1.14.2.nginx using the .spec.template.spec.containers[0].name field.