DevOps

Kubernetes Deployment Manifest (JSON) JSON Example

A Kubernetes Deployment manifest as a JSON example — includes replicas, selector, pod template, container image, ports, resources, and probes. Copy-ready for kubectl and GitOps.

{
  "apiVersion": "apps/v1",
  "kind": "Deployment",
  "metadata": {
    "name": "web",
    "namespace": "production",
    "labels": {
      "app": "web"
    }
  },
  "spec": {
    "replicas": 3,
    "selector": {
      "matchLabels": {
        "app": "web"
      }
    },
    "template": {
      "metadata": {
        "labels": {
          "app": "web"
        }
      },
      "spec": {
        "containers": [
          {
            "name": "web",
            "image": "ghcr.io/acme/web:1.4.0",
            "ports": [
              {
                "containerPort": 8080
              }
            ],
            "resources": {
              "requests": {
                "cpu": "100m",
                "memory": "128Mi"
              },
              "limits": {
                "cpu": "500m",
                "memory": "256Mi"
              }
            },
            "readinessProbe": {
              "httpGet": {
                "path": "/healthz",
                "port": 8080
              },
              "initialDelaySeconds": 5
            },
            "env": [
              {
                "name": "NODE_ENV",
                "value": "production"
              }
            ]
          }
        ]
      }
    }
  }
}

Field Reference

apiVersionrequiredstringAPI group/version — apps/v1 for Deployments
kindrequiredstringResource type — 'Deployment'
spec.replicasoptionalintegerDesired number of pod replicas (defaults to 1)
spec.selector.matchLabelsrequiredobjectMust match the pod template labels — links the Deployment to its pods
spec.template.spec.containersrequiredarray<object>Container specs: image, ports, env, resources, probes
resources.limitsoptionalobjectHard CPU/memory caps; the pod is throttled or OOM-killed beyond them

Variants

ServiceA Service that exposes the Deployment's pods inside the cluster.
{
  "apiVersion": "v1",
  "kind": "Service",
  "metadata": {
    "name": "web"
  },
  "spec": {
    "selector": {
      "app": "web"
    },
    "ports": [
      {
        "port": 80,
        "targetPort": 8080
      }
    ],
    "type": "ClusterIP"
  }
}

Common Use Cases

  • Declaring a containerised app's desired state for kubectl apply
  • Storing infrastructure as code in Git for GitOps workflows
  • Generating manifests programmatically from JSON templates
kubernetesk8sdeploymentmanifestdevopscontainers

Validate or format this JSON

One click loads this exact example into the tool — no copy-paste needed. Format it, validate it, explore the tree, or generate TypeScript types instantly.

Frequently Asked Questions

Yes. kubectl accepts both JSON and YAML — YAML is just a superset of JSON, so every manifest has an equivalent JSON form. Many tools generate JSON internally. JSON is handy when producing manifests programmatically or validating against the OpenAPI schema.

The Deployment uses the selector to find and manage its pods. If the selector doesn't match the pod template's labels, the API server rejects the manifest, because the Deployment would create pods it can't track.

Requests are what the scheduler reserves for the pod (guaranteed minimum); limits are the hard ceiling. Exceeding the CPU limit throttles the container; exceeding the memory limit gets it OOM-killed. Set both to keep clusters stable.

Related JSON Examples