Junior — Middle
What is the role of Deployment in managing applications in Kubernetes?
sobes.tech AI
Answer from AI
Deployment in Kubernetes is responsible for managing the lifecycle of applications. Its roles include:
- Providing a declarative description of the desired state of the application (for example, how many replicas should be running).
- Automatically creating and updating Pods according to the description.
- Ensuring scalability — easily increase or decrease the number of replicas.
- Updating applications without downtime — supporting rolling updates.
- Restoring state — if a Pod crashes, Deployment will create a new one to maintain the required number.
Example of a Deployment manifest:
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: my-app-container
image: my-app-image:v1
Thus, Deployment simplifies application management, ensuring stability and ease of updates.