{"action":"opened","issue":{"url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/issues/269","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/issues/269/labels{/name}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/issues/269/comments","events_url":"https://api.github.com/repos/GoogleCloudPlatform/heapster/issues/269/events","html_url":"https://github.com/GoogleCloudPlatform/heapster/issues/269","id":72486503,"number":269,"title":"Update heapster to use kubeconfig credentials on kubernetes","user":{"login":"erictune","id":8105590,"avatar_url":"https://avatars.githubusercontent.com/u/8105590?v=3","gravatar_id":"","url":"https://api.github.com/users/erictune","html_url":"https://github.com/erictune","followers_url":"https://api.github.com/users/erictune/followers","following_url":"https://api.github.com/users/erictune/following{/other_user}","gists_url":"https://api.github.com/users/erictune/gists{/gist_id}","starred_url":"https://api.github.com/users/erictune/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erictune/subscriptions","organizations_url":"https://api.github.com/users/erictune/orgs","repos_url":"https://api.github.com/users/erictune/repos","events_url":"https://api.github.com/users/erictune/events{/privacy}","received_events_url":"https://api.github.com/users/erictune/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-05-01T18:09:05Z","updated_at":"2015-05-01T18:09:05Z","closed_at":null,"body":"In the file where you currently create a client using kubernetes_auth file, do something like this:\r\n\r\n```go\r\nimport (\tkclientcmd \"github.com/GoogleCloudPlatform/kubernetes/pkg/client/clientcmd\" )\r\n...\r\n\r\nkubecfg_file          = flag.String(\"kubecfg_file\", \"\", \"Location of kubecfg file for access to kubernetes service\")\r\n...\r\n\r\nfunc newKubeClient() (*client.Client, error) {\r\n  var config *client.Config\r\n  if *kubecfg_file != \"\" {\r\n    var err error\r\n    if config, err = kclientcmd.NewNonInteractiveDeferredLoadingClientConfig(\r\n      &kclientcmd.ClientConfigLoadingRules{ExplicitPath: *kubecfg_file},\r\n      &kclientcmd.ConfigOverrides{}).ClientConfig(); err != nil {\r\n        return nil, err\r\n    }\r\n  } else {\r\n    // however you handle this case\r\n  }\r\n  return client.New(config), nil\r\n}\r\n```\r\n\r\nAnd in your pod template add:\r\n```yaml\r\nvolumeMounts:\r\n- name: monitoring-token\r\n  mountPath: /etc/kubernetes/kubeconfig\r\n  readOnly: true\r\n```\r\n\r\nand in the heapster container of the pod template add:\r\n```yaml\r\nvolumes:\r\n - name: dns-token\r\n   source:\r\n    secret:\r\n     target:\r\n       kind: Secret\r\n       namespace: default\r\n       name: token-system-monitoring\r\n```\r\n\r\nAnd add this argument to heapster `--kubeconfig=/etc/kubernetes/kubeconfig`"}}