k8s

package
v0.0.0-...-75a017b Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

k8s客户端,必须先初始化 NewForFile 集群外客户端初始化 NewInCluster 集群内客户端初始化 https://github.com/kubernetes/client-go/blob/master/INSTALL.md https://github.com/kubernetes/client-go/tree/master/examples

Index

Constants

View Source
const (
	NamespaceDefault = "default"
)

Variables

Functions

func NewForFile

func NewForFile() error

NewForFile 初始化客户端,使用用户家目录下的.kube/config配置

func NewInCluster

func NewInCluster() error

NewInCluster 初始化客户端 集群内访问 使用pod里的Service Account token /var/run/secrets/kubernetes.io/serviceaccount

func PodsGet

func PodsGet(ctx context.Context, namespace, name string) (*api.Pod, error)

PodsGet 获取单个pod信息

func PodsList

func PodsList(ctx context.Context, namespace string) (*api.PodList, error)

PodsList 获取命名空间所有pod信息,空字符串表示所有命名空间

Types

This section is empty.

Directories

Path Synopsis
集群内客户端 https://github.com/kubernetes/client-go/tree/master/examples/in-cluster-client-configuration
集群内客户端 https://github.com/kubernetes/client-go/tree/master/examples/in-cluster-client-configuration

Jump to

Keyboard shortcuts

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