Kubernetes Deployment Manifest: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(13 intermediate revisions by the same user not shown)
Line 1: Line 1:
=External=
=External=


* https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.14/#deployment-v1-apps
* https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#deployment-v1-apps


=Internal=
=Internal=
Line 11: Line 11:


=Example=
=Example=
 
<font size=-1>
  [[Kubernetes_Manifests#apiVersion|apiVersion]]: apps/v1
  [[Kubernetes_Manifests#apiVersion|apiVersion]]: apps/v1
  [[Kubernetes_Manifests#kind|kind]]: Deployment
  [[Kubernetes_Manifests#kind|kind]]: Deployment
Line 22: Line 22:
   [[#selector|selector]]:
   [[#selector|selector]]:
     matchLabels:
     matchLabels:
       function: 'builder'
       function: builder
   [[#strategy|strategy]]:
   [[#strategy|strategy]]:
   [[#revisionHistoryLimit|revisionHistoryLimit]]:
   [[#revisionHistoryLimit|revisionHistoryLimit]]:
   [[#progressDeadlineSeconds|progressDeadlineSeconds]]:
   [[#progressDeadlineSeconds|progressDeadlineSeconds]]:
   [[#template|template]]:
   [[#template|template]]:
    metadata:
      labels:
        function: builder
      # see [[Kubernetes_Pod_Manifest#Example|pod manifest]]
      ...
    spec:
      # see [[Kubernetes_Pod_Manifest#Example|pod manifest]]
      ...
</font>


=.spec Elements=
=.spec Elements=
Line 33: Line 42:


Specifies the number of desired pods. Defaults to 1.
Specifies the number of desired pods. Defaults to 1.
0 is a valid value, it indicates that the deployment should be created but no pods should be started at the time of the deployment creation. The deployment can be scaled later with [[kubectl scale]].


==selector==
==selector==
Line 56: Line 67:
==template==
==template==


The template describes the pods that will be created.
The template describes the pods that will be created. Its structure is similar to that of a pod manifest.
 
===Pod Names===
See: {{Internal|Kubernetes Deployments#Pod_Name|Deployments &#124; Pod Name}}
 
===Pod Manifest===
{{Internal|Kubernetes_Pod_Manifest#Example|Pod Manifest}}

Latest revision as of 20:10, 29 March 2024

External

Internal

Overview

Example

apiVersion: apps/v1
kind: Deployment
metadata:
  name: archaeopteryx
  labels:
    color: blue
spec:
  replicas: 1
  selector:
    matchLabels:
      function: builder
  strategy:
  revisionHistoryLimit:
  progressDeadlineSeconds:
  template:
    metadata:
      labels:
        function: builder
      # see pod manifest
      ...
    spec:
      # see pod manifest
      ...

.spec Elements

replicas

Specifies the number of desired pods. Defaults to 1.

0 is a valid value, it indicates that the deployment should be created but no pods should be started at the time of the deployment creation. The deployment can be scaled later with kubectl scale.

selector

Specifies the label selector for pods. Existing ReplicaSets whose pods are selected by this will be the ones affected by this deployment. It must match the pod template's labels.

Selector Concepts

strategy

Specifies the deployment strategy to use to replace existing pods with new ones.

https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.14/#deploymentstrategy-v1-apps

revisionHistoryLimit

The number of old ReplicaSets to retain to allow rollback. Defaults to 10.

progressDeadlineSeconds

The maximum time in seconds for a deployment to make progress before it is considered to be failed. The deployment controller will continue to process failed deployments and a condition with a ProgressDeadlineExceeded reason will be surfaced in the deployment status. Note that progress will not be estimated during the time a deployment is paused. Defaults to 600s.

template

The template describes the pods that will be created. Its structure is similar to that of a pod manifest.

Pod Names

See:

Deployments | Pod Name

Pod Manifest

Pod Manifest