25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

k8sutil.go 329 B

1 주 전
123456789101112131415161718
  1. package k8sutil
  2. import (
  3. "k8s.io/client-go/kubernetes"
  4. "k8s.io/client-go/rest"
  5. )
  6. func GetK8sClient() (*kubernetes.Clientset, error) {
  7. config, err := rest.InClusterConfig()
  8. if err != nil {
  9. return nil, err
  10. }
  11. k8sClient, err := kubernetes.NewForConfig(config)
  12. if err != nil {
  13. return nil, err
  14. }
  15. return k8sClient, nil
  16. }