Skip to main content

Seleziona il tipo di risorsa

Deployment

Impostazioni di base
Richieste e limiti di risorse

Richieste

Limiti

Variabili d'ambiente
Deployment.yaml45 righe
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app
  namespace: default
  labels:
    app: my-app
spec:
  replicas: 2
  selector:
    matchLabels:
      app: my-app
  template:
    metadata:
      labels:
        app: my-app
    spec:
      containers:
        - name: my-app
          image: nginx:latest
          ports:
            - containerPort: 80
              protocol: TCP
          resources:
            requests:
              cpu: "100m"
              memory: "128Mi"
            limits:
              cpu: "500m"
              memory: "512Mi"
        env:
          - name: APP_ENV
            value: "production"
          livenessProbe:
            httpGet:
              path: /healthz
              port: 80
            initialDelaySeconds: 30
            periodSeconds: 10
          readinessProbe:
            httpGet:
              path: /ready
              port: 80
            initialDelaySeconds: 5
            periodSeconds: 5

Note per Deployment

  • I nomi devono rispettare RFC 1123: solo alfanumerici minuscoli e trattini.
  • Le richieste/limiti di CPU usano i millicore (es. 100m = 0.1 CPU).
  • La memoria usa suffissi binari: Mi, Gi.
  • Abilita le probe solo se il container espone i percorsi configurati.

Come utilizzare Generatore YAML Kubernetes

Choose resource type

Select the type of manifest to generate: Deployment, Service, ConfigMap, Ingress, StatefulSet or CronJob. Each type has its own dedicated form with relevant fields.

Fill in the form fields

Enter name, namespace, image, CPU/memory resources and other specific properties of the chosen type (e.g. liveness/readiness probes for a Deployment, hosts and TLS for an Ingress).

Read the real-time generated YAML

The YAML manifest updates instantly with every form change, validating names according to the convention used by Kubernetes in RFC 1123.

Copy or download the file

Use "Copy" to paste the manifest directly into another file, or "Download" to get the ready-to-apply YAML file with kubectl apply -f.

Suggerimenti

  • Set realistic request and limit values based on expected load: low values cause throttling/OOM kill, high values waste cluster capacity.
  • Use concurrency policy Forbid for CronJobs if the job should never overlap with an ongoing execution, typical of backup or migration jobs.

Domande frequenti

Why must the name of a resource follow certain rules?

Kubernetes requires resource names to follow RFC 1123 convention: only lowercase alphanumeric characters and hyphens, without starting or ending with a hyphen, and no more than 63 characters. The tool validates this format before generating YAML to avoid errors during apply.

What's the difference between requests and limits for CPU/memory?

Minimum resources requested by the pod, used by the scheduler to decide where to place it. Maximum resource limit for a pod before being throttled (CPU) or terminated due to OOMKilled (memory).

When should I use a Deployment instead of a StatefulSet?

Use a Deployment for stateless interchangeable applications (e.g., APIs, frontend). Use a StatefulSet when you need stable network identities and persistent dedicated storage for each pod, typical of databases or distributed systems (e.g., Postgres, Kafka).

Does generated ingress work immediately in my cluster?

A controller for ingress already installed in the cluster (e.g. ingress-nginx) and the ingressClassName field must match that controller's class. Additionally, TLS requires a Kubernetes.io/tls secret with the name specified in the tlsSecretName field.

Does the tool send data from the form to a server?

No, YAML generation is entirely client-side with JavaScript functions only: no API calls, no data from your cluster or configuration leaves the browser.