Middle+
Kubernetes: what is the difference between Deployment? What does it control?
sobes.tech AI
Answer from AI
Deployment in Kubernetes is an object that manages the creation and updating of a set of Pods. It is responsible for declaratively describing the desired state of the application: how many replicas should be running, which image version to use, the update strategy, etc.
Main functions of Deployment:
- Ensures the automatic launch of the required number of Pods.
- Allows smooth updating of the application (rolling update), minimizing downtime.
- Monitors the state of Pods and restores the required number in case of failures.
Example YAML Deployment:
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
spec:
replicas: 3
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: app-container
image: my-app-image:v1
Thus, Deployment is an abstraction layer over ReplicaSet that simplifies managing the lifecycle of applications in Kubernetes.