we got restConfig and namespace, connection is set up Yay

From this restconfig, Now we need to create respective clients for further operations

we will need following package:

import k8s.io/client-go/kubernetes
kubeClient, err := kubernetes.NewForConfig(restConfig)

it returns clients for APIgroups like:

If you have some custom controller, generated code will have NewForConfig function which you have call separately,

For example, In case of service catalog,

serviceCatalogClient, err := servicecatalogclienset.NewForConfig(restConfig)

Let’s take an example for pod:

kubeClient.CoreV1().Pods(namespace).List