Sobes.tech
Junior — Middle

What is the purpose of the Deployment YAML file in the application deployment process?

sobes.tech AI

Answer from AI

The Deployment YAML file in Kubernetes describes the configuration for deploying an application. It specifies:

  • The number of replicas (pods) of the application.
  • The containers to be run, with their images and parameters.
  • Update and recovery policies.
  • Resources needed by the application (CPU, memory).

This file allows declarative management of the application's state in the cluster, ensuring automatic creation, scaling, and updating of pods.

Example of a simple Deployment YAML:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: myapp-deployment
spec:
  replicas: 3
  selector:
    matchLabels:
      app: myapp
  template:
    metadata:
      labels:
        app: myapp
    spec:
      containers:
      - name: myapp-container
        image: myapp-image:latest
        ports:
        - containerPort: 8080