k8s

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConfig

func NewConfig(kubeconfig string) (*rest.Config, error)

Types

type Client

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

func NewClient

func NewClient(kubeconfig string) (*Client, error)

NewClient 创建一个新的 K8s客户端

func (*Client) CreateDeployment

func (c *Client) CreateDeployment(namespace string, deployment *appsv1.Deployment) (*appsv1.Deployment, error)

CreateDeployment 创建Deployment

func (*Client) CreateResourceByYaml

func (c *Client) CreateResourceByYaml(yamlContent string) error

func (*Client) CreateService

func (c *Client) CreateService(namespace string, service *corev1.Service) (*corev1.Service, error)

CreateService 创建Service

func (*Client) DeleteDeployment

func (c *Client) DeleteDeployment(namespace, name string) error

DeleteDeployment 删除Deployment

func (*Client) DeletePod

func (c *Client) DeletePod(namespace, name string) error

DeletePod 删除Pod

func (*Client) DeleteService

func (c *Client) DeleteService(namespace, name string) error

DeleteService 删除Service

func (*Client) GetClientset

func (c *Client) GetClientset() *kubernetes.Clientset

func (*Client) GetConfig

func (c *Client) GetConfig() *rest.Config

func (*Client) GetDeployment

func (c *Client) GetDeployment(namespace, name string) (*appsv1.Deployment, error)

GetDeployment 获取Deployment

func (*Client) GetDiscoveryClient

func (c *Client) GetDiscoveryClient() *discovery.DiscoveryClient

func (*Client) GetDynamicClient

func (c *Client) GetDynamicClient() *dynamic.DynamicClient

func (*Client) GetMapper

func (*Client) GetPod

func (c *Client) GetPod(namespace, name string) (*corev1.Pod, error)

GetPod 获取Pod

func (*Client) GetService

func (c *Client) GetService(namespace, name string) (*corev1.Service, error)

GetService 获取Service

func (*Client) ListPods

func (c *Client) ListPods(namespace string, opts metav1.ListOptions) (*corev1.PodList, error)

ListPods 列出Pod

func (*Client) RestartDeployment

func (c *Client) RestartDeployment(namespace, name string) error

RestartDeployment 重启Deployment

func (*Client) RestartPod

func (c *Client) RestartPod(namespace, name string) error

RestartPod 重启Pod (通过删除Pod的方式)

func (*Client) UpdateDeployment

func (c *Client) UpdateDeployment(namespace string, deployment *appsv1.Deployment) (*appsv1.Deployment, error)

UpdateDeployment 更新Deployment

func (*Client) UpdateService

func (c *Client) UpdateService(namespace string, service *corev1.Service) (*corev1.Service, error)

UpdateService 更新Service

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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