Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kubernetes client-go creating services and enpdoints

I am looking for pointers on how to create/update services and endpoints using the client-go API. Can't seem to find any examples or documentation on how to do it.

Thanks! Satish

like image 248
Satish Mohan Avatar asked Dec 20 '18 19:12

Satish Mohan


1 Answers

   clientset.CoreV1().Services("kube-system").Create(&corev1.Service{
            ObjectMeta: metav1.ObjectMeta{
                Name:                       controllerSVCName,
                Namespace:                  "kube-system",
                Labels: map[string]string{
                    "k8s-app": "kube-controller-manager",
                },
            },
            Spec: corev1.ServiceSpec{
                Ports:                    nil,
                Selector:                 nil,
                ClusterIP:                "",

            },
   })
like image 85
张馆长 Avatar answered Oct 21 '22 15:10

张馆长