openapi: 3.1.0
info:
title: Kubernetes Autoscaling Workloads API
description: The Kubernetes API lets you query and manipulate the state of objects in Kubernetes. The core of Kubernetes control plane is the API server and the HTTP API that it exposes. Users, the different parts of your cluster, and external components all communicate with one another through the API server. The API is a resource-based (RESTful) programmatic interface provided via HTTP that supports retrieving, creating, updating, and deleting primary resources via the standard HTTP verbs (POST, PUT, PATCH, DELETE, GET).
version: v1.32.0
contact:
name: Kubernetes Community
url: https://kubernetes.io/community/
termsOfService: https://www.apache.org/licenses/LICENSE-2.0
servers:
- url: https://kubernetes.default.svc
description: In-cluster Kubernetes API Server
security:
- bearerAuth: []
- clientCertificate: []
tags:
- name: Workloads
description: Workload resources including Pods, Deployments, StatefulSets, DaemonSets, ReplicaSets, Jobs, and CronJobs for managing containerized applications.
paths:
/api/v1/namespaces/{namespace}/pods:
get:
operationId: listNamespacedPods
summary: Kubernetes List pods in a namespace
description: Returns a list of all pods in the specified namespace. Pods are the smallest deployable units of computing that you can create and manage in Kubernetes. Each pod runs one or more containers.
tags:
- Workloads
parameters:
- $ref: '#/components/parameters/NamespaceParam'
- $ref: '#/components/parameters/LabelSelector'
- $ref: '#/components/parameters/FieldSelector'
- $ref: '#/components/parameters/Limit'
- $ref: '#/components/parameters/Continue'
- $ref: '#/components/parameters/ResourceVersion'
- $ref: '#/components/parameters/Watch'
responses:
'200':
description: List of pods
content:
application/json:
schema:
$ref: '#/components/schemas/PodList'
'401':
$ref: '#/components/responses/Unauthorized'
post:
operationId: createNamespacedPod
summary: Kubernetes Create a pod
description: Creates a new pod in the specified namespace. The API server schedules the pod to a node based on resource requirements, node selectors, affinity rules, and available capacity.
tags:
- Workloads
parameters:
- $ref: '#/components/parameters/NamespaceParam'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Pod'
responses:
'201':
description: Pod created
content:
application/json:
schema:
$ref: '#/components/schemas/Pod'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
/api/v1/namespaces/{namespace}/pods/{name}:
get:
operationId: getNamespacedPod
summary: Kubernetes Get a pod
description: Returns the specified pod object including its current phase, container statuses, resource allocations, and scheduling information.
tags:
- Workloads
parameters:
- $ref: '#/components/parameters/NamespaceParam'
- $ref: '#/components/parameters/NameParam'
responses:
'200':
description: Pod details
content:
application/json:
schema:
$ref: '#/components/schemas/Pod'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
put:
operationId: replaceNamespacedPod
summary: Kubernetes Replace a pod
description: Replaces the specified pod with the provided definition. Note that many pod fields are immutable after creation; use Deployments for managing pod lifecycle and updates.
tags:
- Workloads
parameters:
- $ref: '#/components/parameters/NamespaceParam'
- $ref: '#/components/parameters/NameParam'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Pod'
responses:
'200':
description: Pod updated
content:
application/json:
schema:
$ref: '#/components/schemas/Pod'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
delete:
operationId: deleteNamespacedPod
summary: Kubernetes Delete a pod
description: Deletes the specified pod. By default, Kubernetes sends SIGTERM to the container and waits for the grace period before forcefully terminating it. Running pods will be restarted by their controller (e.g. Deployment).
tags:
- Workloads
parameters:
- $ref: '#/components/parameters/NamespaceParam'
- $ref: '#/components/parameters/NameParam'
- $ref: '#/components/parameters/GracePeriod'
responses:
'200':
description: Pod deleted
content:
application/json:
schema:
$ref: '#/components/schemas/Pod'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
/api/v1/namespaces/{namespace}/pods/{name}/log:
get:
operationId: readNamespacedPodLog
summary: Kubernetes Read pod logs
description: Returns the log output from a container in the specified pod. Supports streaming with the follow parameter, filtering by timestamps, and reading from specific containers in multi-container pods.
tags:
- Workloads
parameters:
- $ref: '#/components/parameters/NamespaceParam'
- $ref: '#/components/parameters/NameParam'
- name: container
in: query
description: Name of the container to read logs from. Defaults to only container if there is only one, otherwise required.
schema:
type: string
- name: follow
in: query
description: Whether to stream log output. If false, returns current log snapshot.
schema:
type: boolean
- name: tailLines
in: query
description: Number of lines from the end of the log to retrieve.
schema:
type: integer
- name: sinceSeconds
in: query
description: Only return logs newer than a relative duration in seconds.
schema:
type: integer
responses:
'200':
description: Pod log output
content:
text/plain:
schema:
type: string
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
/apis/apps/v1/namespaces/{namespace}/deployments:
get:
operationId: listNamespacedDeployments
summary: Kubernetes List deployments in a namespace
description: Returns a list of all deployments in the specified namespace. Deployments provide declarative updates for Pods and ReplicaSets, enabling rolling updates, rollbacks, and scaling of stateless applications.
tags:
- Workloads
parameters:
- $ref: '#/components/parameters/NamespaceParam'
- $ref: '#/components/parameters/LabelSelector'
- $ref: '#/components/parameters/FieldSelector'
- $ref: '#/components/parameters/Limit'
- $ref: '#/components/parameters/Watch'
responses:
'200':
description: List of deployments
content:
application/json:
schema:
$ref: '#/components/schemas/DeploymentList'
'401':
$ref: '#/components/responses/Unauthorized'
post:
operationId: createNamespacedDeployment
summary: Kubernetes Create a deployment
description: Creates a new deployment in the specified namespace. Deployments manage a set of identical pods based on a pod template and ensure the desired number of replicas are running at all times.
tags:
- Workloads
parameters:
- $ref: '#/components/parameters/NamespaceParam'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Deployment'
responses:
'201':
description: Deployment created
content:
application/json:
schema:
$ref: '#/components/schemas/Deployment'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
/apis/apps/v1/namespaces/{namespace}/deployments/{name}:
get:
operationId: getNamespacedDeployment
summary: Kubernetes Get a deployment
description: Returns the specified deployment including its current rollout status, desired replica count, available replicas, and update strategy.
tags:
- Workloads
parameters:
- $ref: '#/components/parameters/NamespaceParam'
- $ref: '#/components/parameters/NameParam'
responses:
'200':
description: Deployment details
content:
application/json:
schema:
$ref: '#/components/schemas/Deployment'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
put:
operationId: replaceNamespacedDeployment
summary: Kubernetes Replace a deployment
description: Replaces the specified deployment configuration. Updating the pod template spec triggers a rolling update of the managed pods according to the deployment's update strategy.
tags:
- Workloads
parameters:
- $ref: '#/components/parameters/NamespaceParam'
- $ref: '#/components/parameters/NameParam'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Deployment'
responses:
'200':
description: Deployment updated
content:
application/json:
schema:
$ref: '#/components/schemas/Deployment'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
delete:
operationId: deleteNamespacedDeployment
summary: Kubernetes Delete a deployment
description: Deletes the specified deployment and its managed ReplicaSet and pods. The pods are terminated gracefully according to the configured termination grace period.
tags:
- Workloads
parameters:
- $ref: '#/components/parameters/NamespaceParam'
- $ref: '#/components/parameters/NameParam'
responses:
'200':
description: Deployment deleted
content:
application/json:
schema:
$ref: '#/components/schemas/Deployment'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
/apis/apps/v1/namespaces/{namespace}/deployments/{name}/scale:
get:
operationId: getNamespacedDeploymentScale
summary: Kubernetes Get deployment scale
description: Returns the current scale subresource for the specified deployment, including desired and actual replica counts.
tags:
- Workloads
parameters:
- $ref: '#/components/parameters/NamespaceParam'
- $ref: '#/components/parameters/NameParam'
responses:
'200':
description: Deployment scale object
content:
application/json:
schema:
$ref: '#/components/schemas/Scale'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
put:
operationId: replaceNamespacedDeploymentScale
summary: Kubernetes Scale a deployment
description: Updates the replica count of the specified deployment by replacing the scale subresource. The deployment controller adjusts the number of running pods to match the new desired replica count.
tags:
- Workloads
parameters:
- $ref: '#/components/parameters/NamespaceParam'
- $ref: '#/components/parameters/NameParam'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Scale'
responses:
'200':
description: Deployment scale updated
content:
application/json:
schema:
$ref: '#/components/schemas/Scale'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
components:
schemas:
PodStatus:
type: object
description: Most recently observed status of the pod. This data may not be up-to-date and is populated by the system.
properties:
phase:
type: string
enum:
- Pending
- Running
- Succeeded
- Failed
- Unknown
description: Current lifecycle phase of the pod.
podIP:
type: string
description: IP address allocated to the pod. Routable within the cluster.
hostIP:
type: string
description: IP address of the host node running this pod.
startTime:
type: string
format: date-time
description: Time at which the pod was acknowledged by the kubelet.
conditions:
type: array
description: Current service state of the pod.
items:
$ref: '#/components/schemas/PodCondition'
Scale:
type: object
description: Scale represents the scaling subresource of a workload resource. Used to read and update the replica count independently of the full resource spec.
properties:
apiVersion:
type: string
kind:
type: string
const: Scale
metadata:
$ref: '#/components/schemas/ObjectMeta'
spec:
type: object
properties:
replicas:
type: integer
description: Desired number of replicas.
status:
type: object
properties:
replicas:
type: integer
description: Actual number of observed replicas.
Container:
type: object
description: A single container to run within a pod. Defines the container image, command, environment, resource requirements, ports, and volume mounts.
required:
- name
- image
properties:
name:
type: string
description: Unique name of the container within the pod.
image:
type: string
description: Container image name in the format [registry/]repository[:tag]. The tag defaults to 'latest' if not specified.
command:
type: array
items:
type: string
description: Entrypoint command array. Replaces the container image's ENTRYPOINT.
args:
type: array
items:
type: string
description: Arguments to the entrypoint. Replaces the container image's CMD.
env:
type: array
description: List of environment variables to set in the container.
items:
$ref: '#/components/schemas/EnvVar'
ports:
type: array
description: List of ports to expose from the container.
items:
$ref: '#/components/schemas/ContainerPort'
resources:
$ref: '#/components/schemas/ResourceRequirements'
imagePullPolicy:
type: string
enum:
- Always
- Never
- IfNotPresent
description: Image pull policy. Defaults to Always if the tag is :latest, otherwise IfNotPresent.
DeploymentSpec:
type: object
description: Specification for a Deployment, defining the desired state including replica count, pod template, and update strategy.
required:
- selector
- template
properties:
replicas:
type: integer
minimum: 0
description: Desired number of pod replicas. Defaults to 1.
selector:
$ref: '#/components/schemas/LabelSelector'
template:
$ref: '#/components/schemas/PodTemplateSpec'
strategy:
$ref: '#/components/schemas/DeploymentStrategy'
minReadySeconds:
type: integer
description: Minimum seconds a newly created pod should be ready without crashing before being considered available.
revisionHistoryLimit:
type: integer
description: Number of old ReplicaSets to retain for rollback. Defaults to 10.
ResourceRequirements:
type: object
description: Compute resource requirements for a container, specifying resource limits and requests for CPU and memory.
properties:
requests:
type: object
description: Minimum resources required. The container will not be scheduled unless these resources are available on the node.
additionalProperties:
type: string
limits:
type: object
description: Maximum resources the container may consume. The container is throttled (CPU) or killed (memory) if it exceeds limits.
additionalProperties:
type: string
LabelSelector:
type: object
description: A label selector is a query over a set of resources. matchLabels specifies key-value pairs that must match, while matchExpressions supports set-based criteria.
properties:
matchLabels:
type: object
additionalProperties:
type: string
description: Map of key-value pairs that must match resource labels exactly.
matchExpressions:
type: array
description: List of label selector requirements using set-based operators.
items:
$ref: '#/components/schemas/LabelSelectorRequirement'
Pod:
type: object
description: A Pod represents the smallest deployable unit in Kubernetes, encapsulating one or more containers with shared storage and network. Pods are ephemeral by nature and managed by higher-level workload controllers.
properties:
apiVersion:
type: string
const: v1
description: API version of the resource.
kind:
type: string
const: Pod
description: Kind identifier for the resource.
metadata:
$ref: '#/components/schemas/ObjectMeta'
spec:
$ref: '#/components/schemas/PodSpec'
status:
$ref: '#/components/schemas/PodStatus'
Status:
type: object
description: Status is a return value for calls that don't return other objects. It is used to convey error messages, reasons, and codes for both success and failure responses.
properties:
apiVersion:
type: string
kind:
type: string
const: Status
code:
type: integer
description: HTTP status code.
message:
type: string
description: Human-readable description of the status.
reason:
type: string
description: Machine-readable description of why the operation is in this status.
status:
type: string
enum:
- Success
- Failure
description: Outcome of the operation.
DeploymentStrategy:
type: object
description: Strategy for replacing existing pods with new ones during an update. Supports RollingUpdate (default) and Recreate strategies.
properties:
type:
type: string
enum:
- Recreate
- RollingUpdate
description: Type of deployment. Recreate kills all existing pods before creating new ones. RollingUpdate gradually replaces old pods.
rollingUpdate:
type: object
description: Rolling update configuration. Only valid when type is RollingUpdate.
properties:
maxUnavailable:
description: Maximum number of pods that can be unavailable during the update. Can be an absolute number or percentage.
oneOf:
- type: integer
- type: string
maxSurge:
description: Maximum number of pods that can be scheduled above the desired number during an update.
oneOf:
- type: integer
- type: string
ListMeta:
type: object
description: Metadata that all list responses include, containing pagination state and the resource version of the list.
properties:
resourceVersion:
type: string
description: Resource version of the list for use in watch operations.
continue:
type: string
description: Token used to retrieve the next page of results in a paginated list request.
remainingItemCount:
type: integer
description: Number of items remaining in the list if pagination is in effect.
PodSpec:
type: object
description: Specification for the desired behavior of a pod, including the containers to run, volumes to mount, scheduling constraints, and restart policy.
required:
- containers
properties:
containers:
type: array
description: List of containers to run in the pod. Each pod must have at least one container.
items:
$ref: '#/components/schemas/Container'
initContainers:
type: array
description: List of init containers that run before app containers. Each init container must complete successfully before the next starts.
items:
$ref: '#/components/schemas/Container'
nodeName:
type: string
description: Name of the node to schedule this pod on. If specified, bypasses the scheduler's decision.
nodeSelector:
type: object
additionalProperties:
type: string
description: Map of key-value pairs that must match node labels for scheduling.
restartPolicy:
type: string
enum:
- Always
- OnFailure
- Never
description: Restart policy for all containers. Defaults to Always.
serviceAccountName:
type: string
description: Name of the service account to use when mounting service account tokens into pods.
terminationGracePeriodSeconds:
type: integer
description: Duration in seconds the pod needs to terminate gracefully. Defaults to 30 seconds.
PodTemplateSpec:
type: object
description: Template for creating pod replicas. Contains pod metadata (labels, annotations) and a pod spec.
properties:
metadata:
$ref: '#/components/schemas/ObjectMeta'
spec:
$ref: '#/components/schemas/PodSpec'
ObjectMeta:
type: object
description: Standard Kubernetes object metadata included on all persistent resources. Contains identifying information, ownership references, and system-managed fields like resourceVersion and uid.
properties:
name:
type: string
description: Unique name of the object within a namespace or cluster scope.
namespace:
type: string
description: Namespace that scopes the resource name. Not all resource types are namespaced.
uid:
type: string
description: Unique identifier generated by the server for this object. Remains constant for the lifetime of the object.
resourceVersion:
type: string
description: Opaque string that identifies an internal server version of the object. Used for optimistic concurrency control and watch operations.
generation:
type: integer
description: Sequence number representing the generation of the desired state. Incremented by the server on spec changes.
creationTimestamp:
type: string
format: date-time
description: Timestamp when the object was created.
deletionTimestamp:
type: string
format: date-time
description: Time at which the object will be deleted. Set by the server when a delete is requested.
labels:
type: object
additionalProperties:
type: string
description: Map of string keys and values to organize and select resources. Labels are queryable via label selectors.
annotations:
type: object
additionalProperties:
type: string
description: Map of non-identifying metadata. Annotations may contain arbitrary data and are not queryable by the API.
ownerReferences:
type: array
description: List of objects that own this object. Garbage collection will delete this object when all owners are deleted.
items:
$ref: '#/components/schemas/OwnerReference'
Deployment:
type: object
description: A Deployment provides declarative updates for Pods and ReplicaSets. You describe a desired state in a Deployment and the controller changes the actual state to match the desired state at a controlled rate.
properties:
apiVersion:
type: string
const: apps/v1
description: API version of the resource.
kind:
type: string
const: Deployment
description: Kind identifier for the resource.
metadata:
$ref: '#/components/schemas/ObjectMeta'
spec:
$ref: '#/components/schemas/DeploymentSpec'
status:
$ref: '#/components/schemas/DeploymentStatus'
PodList:
type: object
description: A list of pods returned by list operations.
required:
- items
properties:
apiVersion:
type: string
kind:
type: string
const: PodList
metadata:
$ref: '#/components/schemas/ListMeta'
items:
type: array
items:
$ref: '#/components/schemas/Pod'
DeploymentStatus:
type: object
description: Most recently observed status of a Deployment including replica counts and rollout conditions.
properties:
replicas:
type: integer
description: Total number of non-terminated pods targeted by this deployment.
updatedReplicas:
type: integer
description: Total number of pods targeted by this deployment that have the desired template spec.
readyReplicas:
type: integer
description: Total number of ready pods targeted by this deployment.
availableReplicas:
type: integer
description: Total number of available pods targeted by this deployment.
observedGeneration:
type: integer
description: The generation observed by the deployment controller.
DeploymentList:
type: object
description: A list of deployments returned by list operations.
required:
- items
properties:
apiVersion:
type: string
kind:
type: string
const: DeploymentList
metadata:
$ref: '#/components/schemas/ListMeta'
items:
type: array
items:
$ref: '#/components/schemas/Deployment'
EnvVar:
type: object
description: An environment variable to set in a container.
required:
- name
properties:
name:
type: string
description: Name of the environment variable.
value:
type: string
description: Literal string value for the environment variable.
ContainerPort:
type: object
description: A network port that a container exposes. Used for documentation and for service discovery via protocol and port number.
required:
- containerPort
properties:
name:
type: string
description: Name for the port, referenced by services.
containerPort:
type: integer
minimum: 1
maximum: 65535
description: Port number to expose on the container's IP address.
protocol:
type: string
enum:
- TCP
- UDP
- SCTP
description: Protocol for the port. Defaults to TCP.
hostPort:
type: integer
description: Port to expose on the node. Most containers do not need this.
OwnerReference:
type: object
description: Reference to an owning resource that manages this object's lifecycle via garbage collection.
required:
- apiVersion
- kind
- name
- uid
properties:
apiVersion:
type: string
description: API version of the owner resource.
kind:
type: string
description: Kind of the owner resource.
name:
type: string
description: Name of the owner resource.
uid:
type: string
description: UID of the owner resource.
controller:
type: boolean
description: Whether this reference points to the managing controller.
LabelSelectorRequirement:
type: object
description: A requirement that uses set-based operators to match labels.
required:
- key
- operator
properties:
key:
type: string
description: Label key that the selector applies to.
operator:
type: string
enum:
- In
- NotIn
- Exists
- DoesNotExist
description: Represents the key's relationship to a set of values.
values:
type: array
items:
type: string
description: Array of string values used with In and NotIn operators.
PodCondition:
type: object
description: Condition representing the current state of a pod component.
required:
- type
- status
properties:
type:
type: string
enum:
- PodScheduled
- ContainersReady
- Initialized
- Ready
description: Type of pod condition.
status:
type: string
enum:
- 'True'
- 'False'
- Unknown
description: Status of the condition.
message:
type: string
description: Human-readable message indicating details about the condition.
reason:
type: string
description: Brief machine-readable reason for the condition's last transition.
parameters:
Limit:
name: limit
in: query
description: Maximum number of resources to return in a single response. Use with the continue parameter to paginate through large result sets.
schema:
type: integer
minimum: 1
maximum: 500
ResourceVersion:
name: resourceVersion
in: query
description: When specified with a watch call, shows changes that occur after the specified resourceVersion. When specified in a list request, returns results at least as new as the specified resourceVersion.
schema:
type: string
GracePeriod:
name: gracePeriodSeconds
in: query
description: Duration in seconds to wait before forcefully terminating the resource. Defaults to the resource's terminationGracePeriodSeconds setting.
schema:
type: integer
minimum: 0
Watch:
name: watch
in: query
description: Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion to watch from a specific version.
schema:
type: boolean
Continue:
name: continue
in: query
description: Pagination token returned in a previous res
# --- truncated at 32 KB (34 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/kubernetes/refs/heads/main/openapi/kubernetes-workloads-api-openapi.yml