Closed ppiccolo closed 5 years ago
Ok ... I can assume that it's not compatible with rancher2 and rancherOS, the problem is that it's unable to detect the cluster IP because in rancherOS there is nothing under the default kubernetes configuration folder.
At this point I suppose that the issue is more related with rancher stuff.
// NewKubeClient returns a new Kubernetes client object. It takes a Config and
// uses KubeMaster and KubeConfig attributes to connect to the cluster. If
// KubeConfig isn't provided it defaults to using the recommended default.
func NewKubeClient(kubeConfig, kubeMaster string, requestTimeout time.Duration) (*kubernetes.Clientset, error) {
if kubeConfig == "" {
if _, err := os.Stat(clientcmd.RecommendedHomeFile); err == nil {
kubeConfig = clientcmd.RecommendedHomeFile
}
}
config, err := clientcmd.BuildConfigFromFlags(kubeMaster, kubeConfig)
if err != nil {
return nil, err
}
config.WrapTransport = func(rt http.RoundTripper) http.RoundTripper {
return instrumented_http.NewTransport(rt, &instrumented_http.Callbacks{
PathProcessor: func(path string) string {
parts := strings.Split(path, "/")
return parts[len(parts)-1]
},
})
}
config.Timeout = requestTimeout
client, err := kubernetes.NewForConfig(config)
if err != nil {
return nil, err
}
log.Infof("Created Kubernetes client %s", config.Host)
return client, nil
}
Hello, I'm using a kubernetes cluster deployed via rancher2, and an external BIND9 instance as DNS.
This is my configuration :
Process fail with following error :
Any suggestion that can point me in the right direction ?
Thanks in advance