src/object

KubernetesObjectApi

Dynamically construct Kubernetes API request URIs so client does not have to know what type of object it is acting on.
class KubernetesObjectApi 

makeApiClient

Create a KubernetesObjectApi object from the provided KubeConfig. This method should be used rather than [[KubeConfig.makeApiClient]] so we can properly determine the default namespace if one is provided by the current context.

Parameters

kc Valid Kubernetes config

return

Properly instantiated [[KubernetesObjectApi]] object

public static makeApiClient(kc: KubeConfig): KubernetesObjectApi 

create

Create any Kubernetes resource.

Parameters

spec Kubernetes resource spec.

pretty If \'true\', then the output is pretty printed.

dryRun When present, indicates that modifications should not be persisted. An invalid or unrecognized

dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed

fieldManager fieldManager is a name associated with the actor or entity that is making these changes. The

value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.

options Optional headers to use in the request.

return

Promise containing the request response and [[KubernetesObject]].

public async create<T extends KubernetesObject | KubernetesObject>(
        spec: T,        pretty?: string,        dryRun?: string,        fieldManager?: string,        options?: Configuration,    ): Promise<T> 

delete

Delete any Kubernetes resource.

Parameters

spec Kubernetes resource spec

pretty If \'true\', then the output is pretty printed.

dryRun When present, indicates that modifications should not be persisted. An invalid or unrecognized

dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed

gracePeriodSeconds The duration in seconds before the object should be deleted. Value must be non-negative

integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.

orphanDependents Deprecated: please use the PropagationPolicy, this field will be deprecated in

1.7. Should the dependent objects be orphaned. If true/false, the \"orphan\" finalizer will be added to/removed from the object\'s finalizers list. Either this field or PropagationPolicy may be set, but not both.

propagationPolicy Whether and how garbage collection will be performed. Either this field or

OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: \'Orphan\' - orphan the dependents; \'Background\' - allow the garbage collector to delete the dependents in the background; \'Foreground\' - a cascading policy that deletes all dependents in the foreground.

body See [[V1DeleteOptions]].

options Optional headers to use in the request.

return

Promise containing the request response and a Kubernetes [[V1Status]].

public async delete(
        spec: KubernetesObject,        pretty?: string,        dryRun?: string,        gracePeriodSeconds?: number,        orphanDependents?: boolean,        propagationPolicy?: string,        body?: V1DeleteOptions,        options?: Configuration,    ): Promise<V1Status> 

patch

Patch any Kubernetes resource.

Parameters

spec Kubernetes resource spec

pretty If \'true\', then the output is pretty printed.

dryRun When present, indicates that modifications should not be persisted. An invalid or unrecognized

dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed

fieldManager fieldManager is a name associated with the actor or entity that is making these changes. The

value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch).

force Force is going to \"force\" Apply requests. It means user will re-acquire conflicting

fields owned by other people. Force flag must be unset for non-apply patch requests.

patchStrategy Content-Type header used to control how the patch will be performed. See

See https://kubernetes.io/docs/tasks/run-application/update-api-object-kubectl-patch/ for details.

options Optional headers to use in the request.

return

Promise containing the request response and [[KubernetesObject]].

public async patch<T extends KubernetesObject | KubernetesObject>(
        spec: T,        pretty?: string,        dryRun?: string,        fieldManager?: string,        force?: boolean,        patchStrategy: PatchStrategy = PatchStrategy.StrategicMergePatch,        options?: Configuration,    ): Promise<T> 

read

Read any Kubernetes resource.

Parameters

spec Kubernetes resource spec

pretty If \'true\', then the output is pretty printed.

exact Should the export be exact. Exact export maintains cluster-specific fields like

\'Namespace\'. Deprecated. Planned for removal in 1.18.

exportt Should this value be exported. Export strips fields that a user can not

specify. Deprecated. Planned for removal in 1.18.

options Optional headers to use in the request.

return

Promise containing the request response and [[KubernetesObject]].

public async read<T extends KubernetesObject | KubernetesObject>(
        spec: KubernetesObjectHeader<T>,        pretty?: string,        exact?: boolean,        exportt?: boolean,        options?: Configuration,    ): Promise<T> 

list

List any Kubernetes resources.

Parameters

apiVersion api group and version of the form /

kind Kubernetes resource kind

namespace list resources in this namespace

pretty If \'true\', then the output is pretty printed.

exact Should the export be exact. Exact export maintains cluster-specific fields like

\'Namespace\'. Deprecated. Planned for removal in 1.18.

exportt Should this value be exported. Export strips fields that a user can not

specify. Deprecated. Planned for removal in 1.18.

fieldSelector A selector to restrict the list of returned objects by their fields. Defaults to everything.

labelSelector A selector to restrict the list of returned objects by their labels. Defaults to everything.

limit Number of returned resources.

options Optional headers to use in the request.

return

Promise containing the request response and [[KubernetesListObject]].

public async list<T extends KubernetesObject | KubernetesObject>(
        apiVersion: string,        kind: string,        namespace?: string,        pretty?: string,        exact?: boolean,        exportt?: boolean,        fieldSelector?: string,        labelSelector?: string,        limit?: number,        continueToken?: string,        options?: Configuration,    ): Promise<KubernetesListObject<T>> 

replace

Replace any Kubernetes resource.

Parameters

spec Kubernetes resource spec

pretty If \'true\', then the output is pretty printed.

dryRun When present, indicates that modifications should not be persisted. An invalid or unrecognized

dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed

fieldManager fieldManager is a name associated with the actor or entity that is making these changes. The

value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.

options Optional headers to use in the request.

return

Promise containing the request response and [[KubernetesObject]].

public async replace<T extends KubernetesObject | KubernetesObject>(
        spec: T,        pretty?: string,        dryRun?: string,        fieldManager?: string,        options?: Configuration,    ): Promise<T> 

© 2025 Kubernetes client. All rights reserved.

Start typing to search the documentation Press ESC to close