kubectl

package
v5.20.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 18, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package kubectl provides a kubectl client implementation.

This package wraps kubectl command functionality and provides client methods for executing kubectl operations programmatically, including apply, create, delete, get, describe, and other standard kubectl commands.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrResourceCommandNotFound is returned when a kubectl create subcommand is not found.
	ErrResourceCommandNotFound = errors.New("kubectl create command not found for resource type")
	// ErrNoRunFunction is returned when a kubectl command has neither RunE nor Run function.
	ErrNoRunFunction = errors.New("no run function found for kubectl create command")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client wraps kubectl command functionality.

func NewClient

func NewClient(streams genericiooptions.IOStreams) *Client

NewClient creates a new kubectl client instance.

func NewClientWithStdio

func NewClientWithStdio() *Client

NewClientWithStdio returns a kubectl client wired to the default stdio streams.

func (*Client) CreateApplyCommand

func (c *Client) CreateApplyCommand(kubeConfigPath string) *cobra.Command

CreateApplyCommand creates a kubectl apply command with all its flags and behavior.

func (*Client) CreateClusterInfoCommand

func (c *Client) CreateClusterInfoCommand(kubeConfigPath string) *cobra.Command

CreateClusterInfoCommand wires kubectl's cluster-info with minimal guarding.

func (*Client) CreateClusterRoleBindingCmd

func (c *Client) CreateClusterRoleBindingCmd() (*cobra.Command, error)

CreateClusterRoleBindingCmd creates a ClusterRoleBinding manifest generator command using the client's IO streams.

func (*Client) CreateClusterRoleCmd

func (c *Client) CreateClusterRoleCmd() (*cobra.Command, error)

CreateClusterRoleCmd creates a ClusterRole manifest generator command using the client's IO streams.

func (*Client) CreateConfigMapCmd

func (c *Client) CreateConfigMapCmd() (*cobra.Command, error)

CreateConfigMapCmd creates a ConfigMap manifest generator command using the client's IO streams.

func (*Client) CreateCreateCommand

func (c *Client) CreateCreateCommand(kubeConfigPath string) *cobra.Command

CreateCreateCommand creates a kubectl create command with all its flags and behavior.

func (*Client) CreateCronJobCmd

func (c *Client) CreateCronJobCmd() (*cobra.Command, error)

CreateCronJobCmd creates a CronJob manifest generator command using the client's IO streams.

func (*Client) CreateDeleteCommand

func (c *Client) CreateDeleteCommand(kubeConfigPath string) *cobra.Command

CreateDeleteCommand creates a kubectl delete command with all its flags and behavior.

func (*Client) CreateDeploymentCmd

func (c *Client) CreateDeploymentCmd() (*cobra.Command, error)

CreateDeploymentCmd creates a Deployment manifest generator command using the client's IO streams.

func (*Client) CreateDescribeCommand

func (c *Client) CreateDescribeCommand(kubeConfigPath string) *cobra.Command

CreateDescribeCommand creates a kubectl describe command with all its flags and behavior.

func (*Client) CreateEditCommand

func (c *Client) CreateEditCommand(kubeConfigPath string) *cobra.Command

CreateEditCommand creates a kubectl edit command with all its flags and behavior.

func (*Client) CreateExecCommand

func (c *Client) CreateExecCommand(kubeConfigPath string) *cobra.Command

CreateExecCommand creates a kubectl exec command with all its flags and behavior.

func (*Client) CreateExplainCommand

func (c *Client) CreateExplainCommand(kubeConfigPath string) *cobra.Command

CreateExplainCommand creates a kubectl explain command with all its flags and behavior.

func (*Client) CreateExposeCommand

func (c *Client) CreateExposeCommand(kubeConfigPath string) *cobra.Command

CreateExposeCommand creates a kubectl expose command with all its flags and behavior.

func (*Client) CreateGetCommand

func (c *Client) CreateGetCommand(kubeConfigPath string) *cobra.Command

CreateGetCommand creates a kubectl get command with all its flags and behavior.

func (*Client) CreateIngressCmd

func (c *Client) CreateIngressCmd() (*cobra.Command, error)

CreateIngressCmd creates an Ingress manifest generator command using the client's IO streams.

func (*Client) CreateJobCmd

func (c *Client) CreateJobCmd() (*cobra.Command, error)

CreateJobCmd creates a Job manifest generator command using the client's IO streams.

func (*Client) CreateLogsCommand

func (c *Client) CreateLogsCommand(kubeConfigPath string) *cobra.Command

CreateLogsCommand creates a kubectl logs command with all its flags and behavior.

func (*Client) CreateNamespaceCmd

func (c *Client) CreateNamespaceCmd() (*cobra.Command, error)

CreateNamespaceCmd creates a Namespace manifest generator command using the client's IO streams.

func (*Client) CreatePodDisruptionBudgetCmd

func (c *Client) CreatePodDisruptionBudgetCmd() (*cobra.Command, error)

CreatePodDisruptionBudgetCmd creates a PodDisruptionBudget manifest generator command using the client's IO streams.

func (*Client) CreatePriorityClassCmd

func (c *Client) CreatePriorityClassCmd() (*cobra.Command, error)

CreatePriorityClassCmd creates a PriorityClass manifest generator command using the client's IO streams.

func (*Client) CreateQuotaCmd

func (c *Client) CreateQuotaCmd() (*cobra.Command, error)

CreateQuotaCmd creates a ResourceQuota manifest generator command using the client's IO streams.

func (*Client) CreateRoleBindingCmd

func (c *Client) CreateRoleBindingCmd() (*cobra.Command, error)

CreateRoleBindingCmd creates a RoleBinding manifest generator command using the client's IO streams.

func (*Client) CreateRoleCmd

func (c *Client) CreateRoleCmd() (*cobra.Command, error)

CreateRoleCmd creates a Role manifest generator command using the client's IO streams.

func (*Client) CreateRolloutCommand

func (c *Client) CreateRolloutCommand(kubeConfigPath string) *cobra.Command

CreateRolloutCommand creates a kubectl rollout command with all its flags and behavior.

func (*Client) CreateScaleCommand

func (c *Client) CreateScaleCommand(kubeConfigPath string) *cobra.Command

CreateScaleCommand creates a kubectl scale command with all its flags and behavior.

func (*Client) CreateSecretCmd

func (c *Client) CreateSecretCmd() (*cobra.Command, error)

CreateSecretCmd creates a Secret manifest generator command using the client's IO streams.

func (*Client) CreateServiceAccountCmd

func (c *Client) CreateServiceAccountCmd() (*cobra.Command, error)

CreateServiceAccountCmd creates a ServiceAccount manifest generator command using the client's IO streams.

func (*Client) CreateServiceCmd

func (c *Client) CreateServiceCmd() (*cobra.Command, error)

CreateServiceCmd creates a Service manifest generator command using the client's IO streams.

func (*Client) CreateWaitCommand

func (c *Client) CreateWaitCommand(kubeConfigPath string) *cobra.Command

CreateWaitCommand creates a kubectl wait command with all its flags and behavior.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL