function getInCluster () {
  const host = process.env.KUBERNETES_SERVICE_HOST
  const port = process.env.KUBERNETES_SERVICE_PORT
  if (!host || !port) {
    throw new TypeError(
      'Unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST' +
      ' and KUBERNETES_SERVICE_PORT must be defined')
  }

  const ca = fs.readFileSync(caPath, 'utf8')
  const bearer = fs.readFileSync(tokenPath, 'utf8')
  const namespace = fs.readFileSync(namespacePath, 'utf8')

  return {
    url: `https://${host}:${port}`,
    ca,
    auth: { bearer },
    namespace
  }
}
Returns with in cluster config
Based on: https://github.com/kubernetes/client-go/blob/124670e99da15091e13916f0ad4b2b2df2a39cd5/rest/config.go#L274
and http://kubernetes.io/docs/user-guide/accessing-the-cluster/#accessing-the-api-from-a-pod

@function getInCluster
@returns {Object} { url, cert, auth, namespace }