Merge pull request #59 from spring-financial-group/upgrade-g-1.26.3 chore: upgrade go 1.26.3
Merge pull request #59 from spring-financial-group/upgrade-g-1.26.3
chore: upgrade go 1.26.3
Used to create a kubernetes client from within a Kubernetes cluster or outside using ~/.kube/config
Here’s an example which also uses Jenkins X logging
import ( "github.com/jenkins-x/jx-kube-client/v3/pkg/kubeclient" "github.com/jenkins-x/jx-logging/v3/pkg/log" "k8s.io/client-go/kubernetes" ) func main() { f := kubeclient.NewFactory() cfg, err := f.CreateKubeConfig() if err != nil { log.Logger().Fatalf("failed to get kubernetes config: %v", err) } kubeClient, err := kubernetes.NewForConfig(cfg) if err != nil { log.Logger().Fatalf("error building kubernetes clientset: %v", err) } }
To change the location of the kube config use the following instead:
cfg, err := f.CreateKubeConfigFromCustomLocation(kubeConfigPath, kubeConfigFile)
Part of Jenkins X shared libraries.
版权所有:中国计算机学会技术支持:开源发展技术委员会 京ICP备13000930号-9 京公网安备 11010802047560号
jx-kube-client
Used to create a kubernetes client from within a Kubernetes cluster or outside using ~/.kube/config
Here’s an example which also uses Jenkins X logging
To change the location of the kube config use the following instead:
Part of Jenkins X shared libraries.