func NewConfigAndClient(fpath string) (*rest.Config, *kubernetes.Clientset, error) {
	var config *rest.Config
	var err error
	if fpath == "" {
		config, err = rest.InClusterConfig()
	} else {
		config, err = clientcmd.BuildConfigFromFlags("", fpath)
	}
	if err != nil {
		return nil, nil, errors.Wrap(err, "create kubernetes config")
	}
	client, err := kubernetes.NewForConfig(config)
	return config, client, errors.Wrap(err, "create kubernetes client")
}
NewConfigAndClient returns new Kubernetes config and client.
It reads config from fpath. If fpath is empty, it assumes in-cluster config.
package kube
import (
	"github.com/pkg/errors"
	"k8s.io/client-go/kubernetes"
	"k8s.io/client-go/rest"
	"k8s.io/client-go/tools/clientcmd"
)